Struct sval_buffer::ValueBuf
source · pub struct ValueBuf<'sval> { /* private fields */ }
Expand description
Buffer arbitrary values into a tree-like structure.
This type requires the alloc
or std
features, otherwise most methods
will fail.
Implementations§
source§impl<'sval> ValueBuf<'sval>
impl<'sval> ValueBuf<'sval>
sourcepub fn collect(v: &'sval impl Value + ?Sized) -> Result<Self, Error>
pub fn collect(v: &'sval impl Value + ?Sized) -> Result<Self, Error>
Buffer a value.
This method will fail if the alloc
feature is not enabled.
sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Whether or not the contents of the value buffer are complete.
sourcepub fn into_value(self) -> Value<'sval>
pub fn into_value(self) -> Value<'sval>
Convert this buffer into an immutable value.
sourcepub fn into_owned(self) -> Result<ValueBuf<'static>, Error>
pub fn into_owned(self) -> Result<ValueBuf<'static>, Error>
Fully buffer any borrowed data, returning a buffer that doesn’t borrow anything.
This method will fail if the alloc
feature is not enabled.
Trait Implementations§
source§impl<'sval> Stream<'sval> for ValueBuf<'sval>
impl<'sval> Stream<'sval> for ValueBuf<'sval>
source§fn text_fragment(&mut self, fragment: &'sval str) -> Result
fn text_fragment(&mut self, fragment: &'sval str) -> Result
Stream a fragment of UTF8 text.
source§fn text_fragment_computed(&mut self, fragment: &str) -> Result
fn text_fragment_computed(&mut self, fragment: &str) -> Result
Stream a fragment of UTF8 text, borrowed for some arbitrarily short lifetime.
source§fn binary_fragment(&mut self, fragment: &'sval [u8]) -> Result
fn binary_fragment(&mut self, fragment: &'sval [u8]) -> Result
Stream a fragment of a bitstring.
source§fn binary_fragment_computed(&mut self, fragment: &[u8]) -> Result
fn binary_fragment_computed(&mut self, fragment: &[u8]) -> Result
Stream a fragment of a bitstring, borrowed for some arbitrarily short lifetime.
source§fn binary_end(&mut self) -> Result
fn binary_end(&mut self) -> Result
Complete a bitstring.
source§fn map_begin(&mut self, num_entries_hint: Option<usize>) -> Result
fn map_begin(&mut self, num_entries_hint: Option<usize>) -> Result
Start a homogenous mapping of arbitrary keys to values.
source§fn map_key_begin(&mut self) -> Result
fn map_key_begin(&mut self) -> Result
Start a key in a key-value mapping.
source§fn map_key_end(&mut self) -> Result
fn map_key_end(&mut self) -> Result
Complete a key in a key-value mapping.
source§fn map_value_begin(&mut self) -> Result
fn map_value_begin(&mut self) -> Result
Start a value in a key-value mapping.
source§fn map_value_end(&mut self) -> Result
fn map_value_end(&mut self) -> Result
Complete a value in a key-value mapping.
source§fn seq_begin(&mut self, num_entries_hint: Option<usize>) -> Result
fn seq_begin(&mut self, num_entries_hint: Option<usize>) -> Result
Start a homogenous sequence of values.
source§fn seq_value_begin(&mut self) -> Result
fn seq_value_begin(&mut self) -> Result
Start an individual value in a sequence.
source§fn seq_value_end(&mut self) -> Result
fn seq_value_end(&mut self) -> Result
Complete an individual value in a sequence.
source§fn enum_begin(
&mut self,
tag: Option<&Tag>,
label: Option<&Label<'_>>,
index: Option<&Index>
) -> Result
fn enum_begin( &mut self, tag: Option<&Tag>, label: Option<&Label<'_>>, index: Option<&Index> ) -> Result
Start a variant in an enumerated type.
source§fn enum_end(
&mut self,
_: Option<&Tag>,
_: Option<&Label<'_>>,
_: Option<&Index>
) -> Result
fn enum_end( &mut self, _: Option<&Tag>, _: Option<&Label<'_>>, _: Option<&Index> ) -> Result
Complete a variant in an enumerated type.
source§fn tagged_begin(
&mut self,
tag: Option<&Tag>,
label: Option<&Label<'_>>,
index: Option<&Index>
) -> Result
fn tagged_begin( &mut self, tag: Option<&Tag>, label: Option<&Label<'_>>, index: Option<&Index> ) -> Result
Start a tagged value. Read more
source§fn tagged_end(
&mut self,
_: Option<&Tag>,
_: Option<&Label<'_>>,
_: Option<&Index>
) -> Result
fn tagged_end( &mut self, _: Option<&Tag>, _: Option<&Label<'_>>, _: Option<&Index> ) -> Result
Complete a tagged value.
source§fn tag(
&mut self,
tag: Option<&Tag>,
label: Option<&Label<'_>>,
index: Option<&Index>
) -> Result
fn tag( &mut self, tag: Option<&Tag>, label: Option<&Label<'_>>, index: Option<&Index> ) -> Result
Stream a standalone tag. Read more
source§fn record_begin(
&mut self,
tag: Option<&Tag>,
label: Option<&Label<'_>>,
index: Option<&Index>,
num_entries: Option<usize>
) -> Result
fn record_begin( &mut self, tag: Option<&Tag>, label: Option<&Label<'_>>, index: Option<&Index>, num_entries: Option<usize> ) -> Result
Start a record type. Read more
source§fn record_value_begin(&mut self, tag: Option<&Tag>, label: &Label<'_>) -> Result
fn record_value_begin(&mut self, tag: Option<&Tag>, label: &Label<'_>) -> Result
Start a field in a record.
source§fn record_value_end(&mut self, _: Option<&Tag>, _: &Label<'_>) -> Result
fn record_value_end(&mut self, _: Option<&Tag>, _: &Label<'_>) -> Result
Complete a field in a record.
source§fn record_end(
&mut self,
_: Option<&Tag>,
_: Option<&Label<'_>>,
_: Option<&Index>
) -> Result
fn record_end( &mut self, _: Option<&Tag>, _: Option<&Label<'_>>, _: Option<&Index> ) -> Result
Complete a record type.
source§fn tuple_begin(
&mut self,
tag: Option<&Tag>,
label: Option<&Label<'_>>,
index: Option<&Index>,
num_entries: Option<usize>
) -> Result
fn tuple_begin( &mut self, tag: Option<&Tag>, label: Option<&Label<'_>>, index: Option<&Index>, num_entries: Option<usize> ) -> Result
Start a tuple type. Read more
source§fn tuple_value_begin(&mut self, tag: Option<&Tag>, index: &Index) -> Result
fn tuple_value_begin(&mut self, tag: Option<&Tag>, index: &Index) -> Result
Start a field in a tuple.
source§fn tuple_value_end(&mut self, _: Option<&Tag>, _: &Index) -> Result
fn tuple_value_end(&mut self, _: Option<&Tag>, _: &Index) -> Result
Complete a field in a tuple.
source§fn tuple_end(
&mut self,
_: Option<&Tag>,
_: Option<&Label<'_>>,
_: Option<&Index>
) -> Result
fn tuple_end( &mut self, _: Option<&Tag>, _: Option<&Label<'_>>, _: Option<&Index> ) -> Result
Complete a tuple type.
source§impl<'a> Value for ValueBuf<'a>
impl<'a> Value for ValueBuf<'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.
Auto Trait Implementations§
impl<'sval> RefUnwindSafe for ValueBuf<'sval>
impl<'sval> Send for ValueBuf<'sval>
impl<'sval> Sync for ValueBuf<'sval>
impl<'sval> Unpin for ValueBuf<'sval>
impl<'sval> UnwindSafe for ValueBuf<'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