Struct arbitrary::FiniteBuffer [−][src]
pub struct FiniteBuffer<'a> { /* fields omitted */ }
A source of unstructured data with a finite size
This buffer is a finite source of unstructured data. Once the data is exhausted it stays exhausted.
Methods
impl<'a> FiniteBuffer<'a>
[src]
impl<'a> FiniteBuffer<'a>
pub fn new(buffer: &'a [u8], max_len: usize) -> Result<Self, BufferError>
[src]
pub fn new(buffer: &'a [u8], max_len: usize) -> Result<Self, BufferError>
Create a new FiniteBuffer
If the passed buffer
is shorter than max_len the total number of bytes
will be the bytes available in buffer
. If buffer
is longer than
max_len
the buffer will be trimmed.
Trait Implementations
impl<'a> Unstructured for FiniteBuffer<'a>
[src]
impl<'a> Unstructured for FiniteBuffer<'a>
type Error = ()
The error type for Unstructured
, see implementations for details
fn fill_buffer(&mut self, buffer: &mut [u8]) -> Result<(), Self::Error>
[src]
fn fill_buffer(&mut self, buffer: &mut [u8]) -> Result<(), Self::Error>
Fill a buffer
with bytes, forming the unstructured data from which Arbitrary
structured data shall be generated. Read more
fn container_size(&mut self) -> Result<usize, Self::Error>
[src]
fn container_size(&mut self) -> Result<usize, Self::Error>
Generate a size for container. Read more
Auto Trait Implementations
impl<'a> Send for FiniteBuffer<'a>
impl<'a> Send for FiniteBuffer<'a>
impl<'a> Sync for FiniteBuffer<'a>
impl<'a> Sync for FiniteBuffer<'a>