Struct sval_buffer::TextBuf
source · pub struct TextBuf<'sval>(_);
Expand description
Buffer text fragments into a single contiguous string.
In no-std environments, this buffer only supports a single borrowed text fragment. Other methods will fail.
Implementations§
source§impl<'sval> TextBuf<'sval>
impl<'sval> TextBuf<'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 text value into a contiguous string.
sourcepub fn push_fragment(&mut self, fragment: &'sval str) -> Result<(), Error>
pub fn push_fragment(&mut self, fragment: &'sval str) -> Result<(), Error>
Push a borrowed text fragment onto the buffer.
sourcepub fn push_fragment_computed(&mut self, fragment: &str) -> Result<(), Error>
pub fn push_fragment_computed(&mut self, fragment: &str) -> Result<(), Error>
Push a computed text 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_str(&self) -> Option<&'sval str>
pub fn as_borrowed_str(&self) -> Option<&'sval str>
Try get the contents of the buffer as a string borrowed for the 'sval
lifetime.
Trait Implementations§
source§impl<'sval> PartialEq<TextBuf<'sval>> for TextBuf<'sval>
impl<'sval> PartialEq<TextBuf<'sval>> for TextBuf<'sval>
source§impl<'a> Value for TextBuf<'a>
impl<'a> Value for TextBuf<'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.