Skip to main content

Id

Trait Id 

Source
pub trait Id {
    // Required method
    fn id(&self) -> u16;
}
Expand description

An identified type.

A type can implement this trait to provide an id, possibly defined interally in the type. For example:

use monstermaker_core::Id;

struct Foo {
    id: u16,
}

impl Id for Foo {
    fn id(&self) -> u16 {
        self.id
    }
}

Required Methods§

Source

fn id(&self) -> u16

Returns the object’s id.

Implementors§