Trait HasNote

Source
pub trait HasNote: HasId {
    // Required methods
    fn get_note(&self, idx: usize) -> Option<&Note>;
    fn add_note(&mut self, note: Note);
    fn remove_note(&mut self, idx: usize) -> Result<Note, String>;
    fn note(self, note: Note) -> Self;
}
Expand description

Trait for classes with notes

Required Methods§

Source

fn get_note(&self, idx: usize) -> Option<&Note>

Get a specific note if it exists

Source

fn add_note(&mut self, note: Note)

Add a new note

Source

fn remove_note(&mut self, idx: usize) -> Result<Note, String>

Remove a note by index

Source

fn note(self, note: Note) -> Self

Builder pattern to add note on create

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§