Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct WideList<T> {
- hd: T,
- tl: Option<Box<WideList<(T, T)>>>
- }
- impl<T> Clone for WideList<T>
- where
- T: Clone,
- Option<Box<WideList<(T, T)>>>: Clone
- {
- fn clone(&self) -> WideList<T> {
- WideList {
- hd: self.hd.clone(),
- tl: self.tl.clone()
- }
- }
- }
- fn main() {
- let x = WideList { hd: 1i32, tl: Some(Box::new(WideList { hd: (2i32, 3i32), tl: None })) };
- x.clone()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement