[−][src]Trait market::Producer
Produces goods by adding them to the stock of a market.
Associated Types
type Good
The item being produced.
type Error
The error when Self
is not functional.
This can be caused by one of the following:
Self
is in an invalid state- the market has no functional consumers
Required methods
fn produce(&self, good: Self::Good) -> Result<Option<Self::Good>, Self::Error>
Attempts to add good
to the market without blocking.
Returns Some(good)
if self
desired to add it to its stock but the stock was full. Otherwise returns None
.
Errors
An error indicates self
is not functional.
Provided methods
fn produce_all(
&self,
goods: Vec<Self::Good>
) -> Result<Vec<Self::Good>, Self::Error>
&self,
goods: Vec<Self::Good>
) -> Result<Vec<Self::Good>, Self::Error>
Attempts to add each good in goods
to the market without blocking.
Returns the goods that self
desired to add to its stock but the stock was full.
Errors
An error indicates self
is not functional.
fn force(&self, good: Self::Good) -> Result<(), Self::Error>
Implementors
impl<G> Producer for CrossbeamProducer<G>
[src]
type Good = G
type Error = ClosedMarketError
fn produce(&self, good: Self::Good) -> Result<Option<Self::Good>, Self::Error>
[src]
impl<G> Producer for PermanentQueue<G>
[src]
type Good = G
type Error = NeverErr
fn produce(&self, good: Self::Good) -> Result<Option<Self::Good>, Self::Error>
[src]
impl<G> Producer for UnlimitedQueue<G>
[src]
type Good = G
type Error = ClosedMarketError
fn produce(&self, good: Self::Good) -> Result<Option<Self::Good>, Self::Error>
[src]
impl<G, P> Producer for StrippingProducer<G, P> where
P: Producer,
<P as Producer>::Good: StripFrom<G> + Clone + Debug,
<P as Producer>::Error: Debug,
[src]
P: Producer,
<P as Producer>::Good: StripFrom<G> + Clone + Debug,
<P as Producer>::Error: Debug,
type Good = G
type Error = StripError<<P as Producer>::Error>
fn produce(&self, good: Self::Good) -> Result<Option<Self::Good>, Self::Error>
[src]
impl<P, I> Producer for ApprovedProducer<P, I> where
P: Producer,
I: Inspector<Good = <P as Producer>::Good>,
[src]
P: Producer,
I: Inspector<Good = <P as Producer>::Good>,
type Good = <P as Producer>::Good
type Error = <P as Producer>::Error
fn produce(&self, good: Self::Good) -> Result<Option<Self::Good>, Self::Error>
[src]
impl<W> Producer for ByteWriter<W> where
W: Write,
[src]
W: Write,