Skip to main content

Name

Trait Name 

Source
pub trait Name {
    // Required method
    fn name(&self) -> &str;
}
Expand description

A named type.

A type can implement this trait to provide a name, possibly defined internally in the type. For example:

use monstermaker_core::Name;

struct Foo {
    name: &'static str,
}

impl Name for Foo {
    fn name(&self) -> &str {
        self.name
    }
}

Required Methods§

Source

fn name(&self) -> &str

Returns the object’s name.

Implementors§