Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

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
    }
}
Source by doc.rust-lang.org #
 
PREVIOUS NEXT
Tagged: #implement #copy #trait #struct #rust
ADD COMMENT
Topic
Name
1+8 =