Answers for "how to implement the copy trait for a struct rust"

0

how to implement the copy trait for a struct rust

struct MyStruct;

impl Copy for MyStruct { }

impl Clone for MyStruct {
    fn clone(&self) -> MyStruct {
        *self
    }
}
Posted by: Guest on March-03-2022

Browse Popular Code Answers by Language