Skip to content

Latest commit

 

History

History

prototype

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Prototype

Prototype allows cloning objects, even complex ones, without coupling to their specific classes.

Rust has standard Clone implementation (via #[derive(Clone)]) for many types which makes Prototype easy and seamless to use.

let mut circle2 = circle1.clone();

See The Easiest Patterns in Rust.

How to Execute

cargo run --bin prototype

Output

Circle 1: 10, 15, 10
Circle 2: 10, 15, 77