pub trait ASimpleTrait {
    // Required method
    fn get_some_integer(&self) -> i64;

    // Provided method
    fn a_default_print(&self) -> &str { ... }
Expand description

Define a simple trait so we can see how it works.

Note that its a_default_print() method becomes available automatically for DoubleAndOne when we impl ASimpleTrait for DoubleAndOne below.

Required Methods§


fn get_some_integer(&self) -> i64

Have the item return an integer.

Provided Methods§


fn a_default_print(&self) -> &str

Have the item print and then return some string.