Struct std::sync::mpsc_queue::Queue[src]
pub struct Queue<T> {
// some fields omitted
}The multi-producer single-consumer structure. This is not cloneable, but it may be safely shared so long as it is guaranteed that there is only one popper at a time (many pushers are allowed).
Methods
impl<T: Send> Queue<T>
fn new<T: Send>() -> Queue<T>
Creates a new queue that is safe to share among multiple producers and one consumer.
fn push<T: Send>(&self, t: T)
Pushes a new value onto this queue.
fn pop<T: Send>(&self) -> PopResult<T>
Pops some data from this queue.
Note that the current implementation means that this function cannot
return Option<T>. It is possible for this queue to be in an
inconsistent state where many pushes have succeeded and completely
finished, but pops cannot return Some(t). This inconsistent state
happens when a pusher is pre-empted at an inopportune moment.
This inconsistent state means that this queue does indeed have data, but it does not currently have access to it at this time.
fn casual_pop<T: Send>(&self) -> Option<T>
Attempts to pop data from this queue, but doesn't attempt too hard. This
will canonicalize inconsistent states to a None value.