pub struct CharStrBuilder<Builder>(/* private fields */);
Expand description
A builder for a character string.
This type wraps an OctetsBuilder
and in turn implements the
OctetsBuilder
trait, making sure that the content cannot grow beyond
the 255 octet limit of a character string.
Implementations§
source§impl<Builder: EmptyBuilder> CharStrBuilder<Builder>
impl<Builder: EmptyBuilder> CharStrBuilder<Builder>
sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new empty builder with the given capacity.
source§impl<Builder: OctetsBuilder + AsRef<[u8]>> CharStrBuilder<Builder>
impl<Builder: OctetsBuilder + AsRef<[u8]>> CharStrBuilder<Builder>
sourcepub fn from_builder(builder: Builder) -> Result<Self, CharStrError>
pub fn from_builder(builder: Builder) -> Result<Self, CharStrError>
Creates a character string builder from an octet sequence.
If the octet sequence is longer than 255 octets, an error is returned.
source§impl CharStrBuilder<Vec<u8>>
impl CharStrBuilder<Vec<u8>>
sourcepub fn vec_with_capacity(capacity: usize) -> Self
pub fn vec_with_capacity(capacity: usize) -> Self
Creates a new empty builder atop an octets vec with a given capacity.
source§impl CharStrBuilder<BytesMut>
impl CharStrBuilder<BytesMut>
sourcepub fn bytes_with_capacity(capacity: usize) -> Self
pub fn bytes_with_capacity(capacity: usize) -> Self
Creates a new empty builder for a bytes value with a given capacity.
source§impl<Builder> CharStrBuilder<Builder>
impl<Builder> CharStrBuilder<Builder>
source§impl<Builder: AsRef<[u8]>> CharStrBuilder<Builder>
impl<Builder: AsRef<[u8]>> CharStrBuilder<Builder>
Trait Implementations§
source§impl<Builder: Clone> Clone for CharStrBuilder<Builder>
impl<Builder: Clone> Clone for CharStrBuilder<Builder>
source§fn clone(&self) -> CharStrBuilder<Builder>
fn clone(&self) -> CharStrBuilder<Builder>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<Builder: EmptyBuilder> Default for CharStrBuilder<Builder>
impl<Builder: EmptyBuilder> Default for CharStrBuilder<Builder>
source§impl<Builder> OctetsBuilder for CharStrBuilder<Builder>
impl<Builder> OctetsBuilder for CharStrBuilder<Builder>
source§type AppendError = ShortBuf
type AppendError = ShortBuf
The error type when appending data fails. Read more
source§fn append_slice(&mut self, slice: &[u8]) -> Result<(), Self::AppendError>
fn append_slice(&mut self, slice: &[u8]) -> Result<(), Self::AppendError>
Appends the content of a slice to the builder. Read more
Auto Trait Implementations§
impl<Builder> Freeze for CharStrBuilder<Builder>where
Builder: Freeze,
impl<Builder> RefUnwindSafe for CharStrBuilder<Builder>where
Builder: RefUnwindSafe,
impl<Builder> Send for CharStrBuilder<Builder>where
Builder: Send,
impl<Builder> Sync for CharStrBuilder<Builder>where
Builder: Sync,
impl<Builder> Unpin for CharStrBuilder<Builder>where
Builder: Unpin,
impl<Builder> UnwindSafe for CharStrBuilder<Builder>where
Builder: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
source§fn try_octets_into(
self,
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
Performs the conversion.
source§fn octets_into(self) -> Target
fn octets_into(self) -> Target
Performs an infallible conversion.