[−][src]Trait market::Consumer
Retrieves goods from a market.
The order in which goods are retrieved is defined by the implementer.
Associated Types
type Good
The item being consumed.
type Fault: Error + 'static
The fault that could be thrown during consumption.
Required methods
fn consume(&self) -> Result<Self::Good, ConsumeFailure<Self::Fault>>
Retrieves the next good from the market without blocking.
To ensure all functionality of a Consumer
performs as specified, the implementor MUST implement consume
such that all of the following specifications are true:
consume
returns without blocking the current process.- If at least one good is in stock,
consume
returns one of those goods. - If fault
T
is thrown during consumption,consume
throwsConsumeFailure::Fault(T)
. - If there are no goods in stock,
consume
throwsConsumeFailure::EmptyStock
.
Provided methods
fn consume_all(&self) -> Result<Vec<Self::Good>, Self::Fault>
Retrieves all goods held in the market without blocking.
If the stock of the market is empty, an empty list is returned. If a fault is thrown after consuming 1 or more goods, the consumption stops and the fault is ignored.
fn demand(&self) -> Result<Self::Good, Self::Fault>
Retrieves the next good from the market, blocking until one is available.
Implementors
impl Consumer for Waiter
[src]
type Good = ExitStatus
type Fault = WaitProcessError
fn consume(&self) -> Result<Self::Good, ConsumeFailure<Self::Fault>>
[src]
impl<C, I> Consumer for VigilantConsumer<C, I> where
C: Consumer,
I: Inspector<Good = <C as Consumer>::Good> + Debug,
[src]
C: Consumer,
I: Inspector<Good = <C as Consumer>::Good> + Debug,
type Good = <C as Consumer>::Good
type Fault = <C as Consumer>::Fault
fn consume(&self) -> Result<Self::Good, ConsumeFailure<Self::Fault>>
[src]
impl<G> Consumer for CrossbeamConsumer<G> where
G: Debug,
[src]
G: Debug,
type Good = G
type Fault = ClosedMarketFault
fn consume(&self) -> Result<Self::Good, ConsumeFailure<Self::Fault>>
[src]
impl<G> Consumer for StdConsumer<G> where
G: Debug,
[src]
G: Debug,
type Good = G
type Fault = ClosedMarketFault
fn consume(&self) -> Result<Self::Good, ConsumeFailure<Self::Fault>>
[src]
impl<G> Consumer for Reader<G> where
G: AssembleFrom<u8> + Debug + 'static,
<G as AssembleFrom<u8>>::Error: 'static,
[src]
G: AssembleFrom<u8> + Debug + 'static,
<G as AssembleFrom<u8>>::Error: 'static,
type Good = G
type Fault = ReadError<G>
fn consume(&self) -> Result<Self::Good, ConsumeFailure<Self::Fault>>
[src]
impl<G> Consumer for PermanentQueue<G> where
G: Debug,
[src]
G: Debug,
type Good = G
type Fault = Never
fn consume(&self) -> Result<Self::Good, ConsumeFailure<Self::Fault>>
[src]
impl<G> Consumer for UnlimitedQueue<G> where
G: Debug,
[src]
G: Debug,
type Good = G
type Fault = ClosedMarketFault
fn consume(&self) -> Result<Self::Good, ConsumeFailure<Self::Fault>>
[src]
impl<G, T> Consumer for Collector<G, T> where
T: Error + 'static,
[src]
T: Error + 'static,
type Good = G
type Fault = T
fn consume(&self) -> Result<Self::Good, ConsumeFailure<Self::Fault>>
[src]
impl<I, O, E> Consumer for Process<I, O, E> where
O: AssembleFrom<u8> + Debug + 'static,
<O as AssembleFrom<u8>>::Error: 'static,
[src]
O: AssembleFrom<u8> + Debug + 'static,
<O as AssembleFrom<u8>>::Error: 'static,
type Good = O
type Fault = <Reader<O> as Consumer>::Fault
fn consume(&self) -> Result<Self::Good, ConsumeFailure<Self::Fault>>
[src]
impl<O, E> Consumer for Thread<O, E> where
E: Error + 'static,
O: Debug,
[src]
E: Error + 'static,
O: Debug,