Trait market::Consumer [−][src]
Retrieves goods from a market.
The order in which goods are retrieved is defined by the implementer.
Associated Types
type Good
[src]
The item being consumed.
type Failure: Failure
[src]
Describes a failure to successfully complete consumption.
Required methods
fn consume(&self) -> Result<Self::Good, Self::Failure>
[src]
Retrieves the next good from the market without blocking.
SHALL only run in the calling process and return the next good in the market without blocking.
Errors
If fault T
is caught, SHALL throw Self::Failure
F
such that F.fault() == Some(T)
. If self
cannot retrieve a good without blocking, SHALL throw an appropriate Self::Failure
.
Provided methods
fn goods(&self) -> Goods<'_, Self>ⓘ where
Self: Sized,
[src]
Self: Sized,
Returns a Goods
of self
.
fn demand(&self) -> Result<Self::Good, <Self::Failure as Failure>::Fault>
[src]
Retrieves the next good from the market, blocking until one is available.
Errors
If fault T
is caught, SHALL throw T
.
Implementors
impl Consumer for Hammer
[src]
type Good = ()
type Failure = InsufficientStockFailure
fn consume(&self) -> Result<Self::Good, Self::Failure>
[src]
impl<G> Consumer for CrossbeamConsumer<G>
[src]
type Good = G
type Failure = ConsumeFailure<WithdrawnSupplyFault>
fn consume(&self) -> Result<Self::Good, Self::Failure>
[src]
Attempts to retrieve good
from a crossbeam channel.
If attempt fails, throws a ConsumeFailure
describing the failure.
If source of failure is WithdrawnSupplyFault
, provides channel description in failure.
impl<G> Consumer for StdConsumer<G>
[src]
type Good = G
type Failure = ConsumeFailure<WithdrawnSupplyFault>
fn consume(&self) -> Result<Self::Good, Self::Failure>
[src]
impl<G> Consumer for Procurer<G>
[src]
type Good = G
type Failure = InsufficientStockFailure
fn consume(&self) -> Result<Self::Good, Self::Failure>
[src]
impl<G> Consumer for Accepter<G>
[src]
type Good = G
type Failure = InsufficientStockFailure
fn consume(&self) -> Result<Self::Good, Self::Failure>
[src]
impl<G, T> Consumer for Collector<G, T> where
T: TryFrom<ConsumeFailure<T>>,
[src]
T: TryFrom<ConsumeFailure<T>>,
type Good = G
type Failure = ConsumeFailure<T>
fn consume(&self) -> Result<Self::Good, Self::Failure>
[src]
impl<G: AssembleFrom<u8>> Consumer for Reader<G> where
<G as AssembleFrom<u8>>::Error: TryFrom<ConsumeFailure<<G as AssembleFrom<u8>>::Error>>,
[src]
<G as AssembleFrom<u8>>::Error: TryFrom<ConsumeFailure<<G as AssembleFrom<u8>>::Error>>,