pub struct BBQueue { /* fields omitted */ }
A single producer, single consumer, thread safe queue
Create a new BBQueue with a given backing buffer. After giving this
buffer to `BBQueue::new(), the backing buffer must not be used, or
undefined behavior could occur!
Additionally, when using BBQueue::split()
, the BBQueue
struct must
never be moved, otherwise Producer
and Consumer
could corrupt memory
Consider using the bbq!()
macro to safely create a statically
allocated instance, or enable the "std" feature, and instead use the
BBQueue::new_boxed()
constructor.
Request a writable, contiguous section of memory of exactly
sz
bytes. If the buffer size requested is not available,
an error will be returned.
Request a writable, contiguous section of memory of up to
sz
bytes. If a buffer of size sz
is not available, but
some space (0 < available < sz) is available, then a grant
will be given for the remaining size. If no space is available
for writing, an error will be returned
Finalizes a writable grant given by grant()
or grant_max()
.
This makes the data available to be read via read()
.
If used
is larger than the given grant, this function will panic.
Obtains a contiguous slice of committed bytes. This slice may not
contain ALL available bytes, if the writer has wrapped around. The
remaining bytes will be available after all readable bytes are
released
Release a sequence of bytes from the buffer, allowing the space
to be used by later writes
If used
is larger than the given grant, this function will panic.
This method takes a BBQueue
, and returns a set of SPSC handles
that may be given to separate threads. May only be called once
per BBQueue
object, or this function will panic
Creates a Boxed BBQueue
NOTE: This function essentially "leaks" the backing buffer
(e.g. BBQueue::new_boxed(1024)
will leak 1024 bytes). This
may be changed in the future.
Splits a boxed BBQueue
into a producer and consumer
Formats the value using the given formatter. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static