Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[derive(Clone)]
- pub struct Face {
- has_eyes: bool,
- }
- pub struct Cat {
- face: Face,
- }
- fn from_face(face: &Face) -> Cat {
- Cat {
- face: *face,
- }
- }
- fn main() {
- let face = Face{ has_eyes: true };
- let _cloned_face = face.clone();
- let _cat = from_face(&face);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement