Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 513 Bytes

File metadata and controls

25 lines (17 loc) · 513 Bytes

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