NamedBusDevice

Trait NamedBusDevice 

Source
pub trait NamedBusDevice<T>: Display + BusDevice<Timestamp = T, NextDevice = NullDevice<T>> { }
Expand description

A trait for dynamic bus devices, which currently includes methods from Display and BusDevice. Devices implementing this trait can be used with a DynamicBus.

Implemented for all types that implement dependent traits.

Implementations§

Source§

impl<T: 'static> dyn NamedBusDevice<T>

Source

pub fn downcast<D>( self: Box<Self>, ) -> Result<Box<D>, Box<dyn NamedBusDevice<T>>>
where D: NamedBusDevice<T> + 'static,

Attempts to downcast the box to a concrete type.

Source§

impl<T: 'static> dyn NamedBusDevice<T> + 'static

Source

pub fn is<D: NamedBusDevice<T> + 'static>(&self) -> bool

Returns true if the boxed type is the same as D

Source

pub fn downcast_ref<D: NamedBusDevice<T> + 'static>(&self) -> Option<&D>

Returns some reference to the boxed value if it is of type D, or None if it isn’t.

Source

pub fn downcast_mut<D: NamedBusDevice<T> + 'static>(&mut self) -> Option<&mut D>

Returns some mutable reference to the boxed value if it is of type D, or None if it isn’t.

Trait Implementations§

Source§

impl<'a, T, D> From<D> for Box<dyn NamedBusDevice<T> + 'a>
where D: BusDevice<Timestamp = T, NextDevice = NullDevice<T>> + Display + 'a,

Source§

fn from(dev: D) -> Self

Converts to this type from the input type.

Implementors§

Source§

impl<T, D> NamedBusDevice<T> for D
where D: Display + BusDevice<Timestamp = T, NextDevice = NullDevice<T>>,