Skip to main content

DefaultItem

Trait DefaultItem 

Source
pub trait DefaultItem: Item {
    // Required methods
    fn title(&self) -> String;
    fn description(&self) -> String;

    // Provided method
    fn as_default_item(&self) -> Option<&dyn DefaultItem>
       where Self: Sized { ... }
}
Expand description

DefaultItem describes an item designed to work with DefaultDelegate.

Required Methods§

Source

fn title(&self) -> String

Title returns the item’s title.

Source

fn description(&self) -> String

Description returns the item’s description.

Provided Methods§

Source

fn as_default_item(&self) -> Option<&dyn DefaultItem>
where Self: Sized,

Returns Some(self) so the default delegate can view the item.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§