Struct sval_buffer::BinaryBuf
source · pub struct BinaryBuf<'sval> { /* private fields */ }Expand description
Buffer binary fragments into a single contiguous slice.
In no-std environments, this buffer only supports a single borrowed binary fragment. Other methods will fail.
Implementations§
source§impl<'sval> BinaryBuf<'sval>
impl<'sval> BinaryBuf<'sval>
sourcepub fn collect(value: &'sval (impl Value + ?Sized)) -> Result<Self, Error>
pub fn collect(value: &'sval (impl Value + ?Sized)) -> Result<Self, Error>
Buffer a binary value into a contiguous slice.
sourcepub fn push_fragment(&mut self, fragment: &'sval [u8]) -> Result<(), Error>
pub fn push_fragment(&mut self, fragment: &'sval [u8]) -> Result<(), Error>
Push a borrowed binary fragment onto the buffer.
sourcepub fn push_fragment_computed(&mut self, fragment: &[u8]) -> Result<(), Error>
pub fn push_fragment_computed(&mut self, fragment: &[u8]) -> Result<(), Error>
Push a computed binary fragment onto the buffer.
If the std feature of this library is enabled, this method will
buffer the fragment. In no-std environments this method will fail.
sourcepub fn as_borrowed_slice(&self) -> Option<&'sval [u8]>
pub fn as_borrowed_slice(&self) -> Option<&'sval [u8]>
Try get the contents of the buffer as a slice borrowed for the 'sval lifetime.
Trait Implementations§
source§impl<'sval> PartialEq for BinaryBuf<'sval>
impl<'sval> PartialEq for BinaryBuf<'sval>
source§impl<'a> Value for BinaryBuf<'a>
impl<'a> Value for BinaryBuf<'a>
source§fn stream<'sval, S: Stream<'sval> + ?Sized>(
&'sval self,
stream: &mut S
) -> Result
fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S ) -> Result
Stream this value through a
Stream.source§fn to_f32(&self) -> Option<f32>
fn to_f32(&self) -> Option<f32>
Try convert this value into a 32bit binary floating point number.
impl<'sval> Eq for BinaryBuf<'sval>
impl<'sval> StructuralEq for BinaryBuf<'sval>
impl<'sval> StructuralPartialEq for BinaryBuf<'sval>
Auto Trait Implementations§
impl<'sval> RefUnwindSafe for BinaryBuf<'sval>
impl<'sval> Send for BinaryBuf<'sval>
impl<'sval> Sync for BinaryBuf<'sval>
impl<'sval> Unpin for BinaryBuf<'sval>
impl<'sval> UnwindSafe for BinaryBuf<'sval>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more