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.
cargo run --bin prototype
Circle 1: 10, 15, 10
Circle 2: 10, 15, 77