[][src]Struct strchunk::StrChunkMut

pub struct StrChunkMut { /* fields omitted */ }

A unique reference to a contiguous UTF-8 slice in memory.

StrChunkMut builds on the memory slice view semantics of BytesMut from the bytes crate, with the added guarantee that the content is a valid UTF-8 string.

Implementations

impl StrChunkMut[src]

pub fn new() -> Self[src]

Creates a new StrChunkMut with default capacity.

The returned buffer has initialized length 0 and unspecified capacity.

pub fn with_capacity(capacity: usize) -> Self[src]

Creates a new StrChunkMut with the specified capacity.

The returned buffer will be able to hold strings with lengths of at least capacity without reallocating. The initialized length is 0.

pub fn len(&self) -> usize[src]

Returns the length of the initialized string content in this StrChunkMut.

pub fn is_empty(&self) -> bool[src]

Returns true if the initialized string content in StrChunkMut has a length of 0.

pub fn capacity(&self) -> usize[src]

Returns the maximum length of a string this StrChunkMut can hold without reallocating.

pub fn remaining_mut(&self) -> usize[src]

Returns the maximum length of string content that can be appended past the current length without reallocating.

pub fn reserve(&mut self, additional: usize)[src]

Reserves capacity for at least additional more bytes of string content to be inserted into this StrChunkMut.

pub fn freeze(self) -> StrChunk[src]

Converts self into an immutable StrChunk.

The conversion is zero cost and is used to indicate that the slice referenced by the handle will no longer be mutated. Once the conversion is done, the handle can be cloned and shared across threads.

pub fn as_str(&self) -> &str[src]

Represents the StrChunkMut contents as a string slice.

pub fn as_mut_str(&mut self) -> &mut str[src]

Represents the StrChunkMut contents as a mutable string slice.

pub fn put_char(&mut self, c: char)[src]

Appends a Unicode character, encoded into UTF-8, to the initialized string contents of the StrChunkMut.

Panics

Panics if the remaining capacity is not sufficient to encode the character. Four bytes are enough to encode any char.

pub fn put_str<S: AsRef<str>>(&mut self, string: S)[src]

Appends a string slice to the initialized string contents of the StrChunkMut.

Panics

Panics if the remaining capacity is not sufficient.

Trait Implementations

impl AsMut<str> for StrChunkMut[src]

impl AsRef<[u8]> for StrChunkMut[src]

impl AsRef<str> for StrChunkMut[src]

impl Borrow<str> for StrChunkMut[src]

impl BorrowMut<str> for StrChunkMut[src]

impl Clone for StrChunkMut[src]

impl Debug for StrChunkMut[src]

impl Default for StrChunkMut[src]

impl Deref for StrChunkMut[src]

type Target = str

The resulting type after dereferencing.

impl DerefMut for StrChunkMut[src]

impl Display for StrChunkMut[src]

impl Eq for StrChunkMut[src]

impl<'a> Extend<&'a str> for StrChunkMut[src]

impl Extend<char> for StrChunkMut[src]

impl<'a> From<&'a str> for StrChunkMut[src]

impl From<StrChunkMut> for StrChunk[src]

impl From<StrChunkMut> for Bytes[src]

impl From<StrChunkMut> for BytesMut[src]

impl<'a> FromIterator<&'a str> for StrChunkMut[src]

impl FromIterator<char> for StrChunkMut[src]

impl Hash for StrChunkMut[src]

impl Ord for StrChunkMut[src]

impl<'a> PartialEq<&'a str> for StrChunkMut[src]

impl<'a> PartialEq<Cow<'a, str>> for StrChunkMut[src]

impl PartialEq<StrChunk> for StrChunkMut[src]

impl PartialEq<StrChunkMut> for StrChunk[src]

impl PartialEq<StrChunkMut> for StrChunkMut[src]

impl PartialEq<StrChunkMut> for str[src]

impl<'a> PartialEq<StrChunkMut> for &'a str[src]

impl PartialEq<StrChunkMut> for String[src]

impl<'a> PartialEq<StrChunkMut> for Cow<'a, str>[src]

impl PartialEq<String> for StrChunkMut[src]

impl PartialEq<str> for StrChunkMut[src]

impl<'a> PartialOrd<&'a str> for StrChunkMut[src]

impl<'a> PartialOrd<Cow<'a, str>> for StrChunkMut[src]

impl PartialOrd<StrChunk> for StrChunkMut[src]

impl PartialOrd<StrChunkMut> for StrChunk[src]

impl PartialOrd<StrChunkMut> for StrChunkMut[src]

impl PartialOrd<StrChunkMut> for str[src]

impl<'a> PartialOrd<StrChunkMut> for &'a str[src]

impl PartialOrd<StrChunkMut> for String[src]

impl<'a> PartialOrd<StrChunkMut> for Cow<'a, str>[src]

impl PartialOrd<String> for StrChunkMut[src]

impl PartialOrd<str> for StrChunkMut[src]

impl StructuralEq for StrChunkMut[src]

impl TakeRange<RangeFrom<usize>> for StrChunkMut[src]

type Output = StrChunkMut

The value returned by the take_range method, representing the extracted part of the collection. Read more

impl TakeRange<RangeFull> for StrChunkMut[src]

type Output = StrChunkMut

The value returned by the take_range method, representing the extracted part of the collection. Read more

impl TakeRange<RangeTo<usize>> for StrChunkMut[src]

type Output = StrChunkMut

The value returned by the take_range method, representing the extracted part of the collection. Read more

impl TakeRange<RangeToInclusive<usize>> for StrChunkMut[src]

type Output = StrChunkMut

The value returned by the take_range method, representing the extracted part of the collection. Read more

impl TryFrom<BytesMut> for StrChunkMut[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.