Skip to main content

capability

Function capability 

pub fn capability<C, B>(bus: &B) -> Option<&C>
where C: 'static + ?Sized, B: Bus + ?Sized,
Expand description

The capability C of bus, a trait object type such as dyn Journal: what Bus::capability answers for TypeId::of::<C>(), cast to C. None when the bus does not offer it through the lookup.

ⓘ
let journal = bus_contract::capability::<dyn Journal, _>(&bus);