Skip to main content

capability

Function capability 

Source
pub fn capability<C: ?Sized + 'static, B: Bus + ?Sized>(bus: &B) -> Option<&C>
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);