Struct sval_buffer::TextBuf
source · pub struct TextBuf<'sval> { /* private fields */ }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 collect_display(value: impl Display) -> Result<Self, Error>
pub fn collect_display(value: impl Display) -> Result<Self, Error>
Buffer a displayable 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 push_display(&mut self, value: impl Display) -> Result<(), Error>
pub fn push_display(&mut self, value: impl Display) -> Result<(), Error>
Push a displayable value onto the buffer.
If the std feature of htis 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.
source§impl<'sval> Write for TextBuf<'sval>
impl<'sval> Write for TextBuf<'sval>
impl<'sval> Eq for TextBuf<'sval>
impl<'sval> StructuralEq for TextBuf<'sval>
impl<'sval> StructuralPartialEq for TextBuf<'sval>
Auto Trait Implementations§
impl<'sval> RefUnwindSafe for TextBuf<'sval>
impl<'sval> Send for TextBuf<'sval>
impl<'sval> Sync for TextBuf<'sval>
impl<'sval> Unpin for TextBuf<'sval>
impl<'sval> UnwindSafe for TextBuf<'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