Skip to main content

HasNoteId

Trait HasNoteId 

Source
pub trait HasNoteId {
    // Required methods
    fn id(self) -> u128;
    fn id_index(self) -> u8;
    fn from_id(id: u128) -> Res<Self>
       where Self: Sized;
    fn id_mask(notes: &[Self]) -> u128
       where Self: Sized;
    fn from_id_mask(id_mask: u128) -> Res<Vec<Self>>
       where Self: Sized;
}
Expand description

A trait which allows for encoding the note as a u128 ID.

Required Methods§

Source

fn id(self) -> u128

Returns the ID of the note.

Source

fn id_index(self) -> u8

Returns the position of the 1 for the ID of the note.

Source

fn from_id(id: u128) -> Res<Self>
where Self: Sized,

Returns the note from the given ID.

Source

fn id_mask(notes: &[Self]) -> u128
where Self: Sized,

Returns the ID mask for the given notes.

Source

fn from_id_mask(id_mask: u128) -> Res<Vec<Self>>
where Self: Sized,

Returns the notes from the given ID mask.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§