Trait show_notes::e009::ASimpleTrait
source · 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§
sourcefn get_some_integer(&self) -> i64
fn get_some_integer(&self) -> i64
Have the item return an integer.
Provided Methods§
sourcefn a_default_print(&self) -> &str
fn a_default_print(&self) -> &str
Have the item print and then return some string.