[][src]Crate market

A library to standardize the traits of producing and consuming.

The core purpose of this library is to define the traits of items that interact with markets. A market stores goods in its stock. Producers add goods to the stock while consumers remove goods from the stock. One important characteristic of producers and consumers is that they are not modified by their respective action (producing or consuming). In other words, the signature of the action function starts with fn action(&self, not fn action(&mut self.

Modules

channel

Consumer and Producer implementations for different channel implementations.

io

Implements a Consumer that implements read functionality and a Producer that implements write functionality.

Structs

ApprovedProducer

Produces goods that an Inspector has allowed.

ClosedMarketError

An error consuming a good from a closable market.

Collector

A Consumer that consumes goods of type G from multiple Consumers.

ComposingConsumer

Consumes composite goods of type G from a parts Consumer of type C.

MappedConsumer

A Consumer that maps the consumed good to a new good.

PermanentQueue

An unlimited queue with a producer and consumer that are always functional.

StrippingConsumer

Consumes parts from a Consumer of composite goods.

StrippingProducer

A Producer of type P that produces parts stripped from goods of type G.

UnlimitedQueue

Defines a queue with unlimited size that implements Consumer and Producer.

VigilantConsumer

Consumes goods that an Inspector has allowed.

Enums

NeverErr

An error that will never occur, equivalent to !.

OneShotError

An error when a Producer is trying to produce in a single shot.

StripError

An error producing parts.

Traits

ComposeFrom

Converts an array of parts into a composite good.

Consumer

Consumes goods from the stock of a market.

Inspector

Inspects if goods meet defined requirements.

Producer

Produces goods to be stored in the stock of a market.

StripFrom

Converts a single good into parts.