pub type StrTendril = Tendril<UTF8>;
Expand description
Tendril
for storing native Rust strings.
Aliased Type§
struct StrTendril { /* private fields */ }
Implementations
Source§impl<F, A> Tendril<F, A>where
F: SliceFormat,
A: Atomicity,
impl<F, A> Tendril<F, A>where
F: SliceFormat,
A: Atomicity,
Sourcepub fn from_slice(x: &<F as SliceFormat>::Slice) -> Tendril<F, A>
pub fn from_slice(x: &<F as SliceFormat>::Slice) -> Tendril<F, A>
Build a Tendril
by copying a slice.
Sourcepub fn push_slice(&mut self, x: &<F as SliceFormat>::Slice)
pub fn push_slice(&mut self, x: &<F as SliceFormat>::Slice)
Push a slice onto the end of the Tendril
.
Source§impl<F, A> Tendril<F, A>where
F: for<'a> CharFormat<'a>,
A: Atomicity,
impl<F, A> Tendril<F, A>where
F: for<'a> CharFormat<'a>,
A: Atomicity,
Sourcepub fn pop_front_char<'a>(&'a mut self) -> Option<char>
pub fn pop_front_char<'a>(&'a mut self) -> Option<char>
Remove and return the first character, if any.
Sourcepub fn pop_front_char_run<'a, C, R>(
&'a mut self,
classify: C,
) -> Option<(Tendril<F, A>, R)>
pub fn pop_front_char_run<'a, C, R>( &'a mut self, classify: C, ) -> Option<(Tendril<F, A>, R)>
Remove and return a run of characters at the front of the Tendril
which are classified the same according to the function classify
.
Returns None
on an empty string.
Source§impl<F, A> Tendril<F, A>
impl<F, A> Tendril<F, A>
Sourcepub unsafe fn push_uninitialized(&mut self, n: u32)
pub unsafe fn push_uninitialized(&mut self, n: u32)
Push “uninitialized bytes” onto the end.
Really, this grows the tendril without writing anything to the new area. It’s only defined for byte tendrils because it’s only useful if you plan to then mutate the buffer.
Source§impl<F, A> Tendril<F, A>
impl<F, A> Tendril<F, A>
Sourcepub fn with_capacity(capacity: u32) -> Tendril<F, A>
pub fn with_capacity(capacity: u32) -> Tendril<F, A>
Create a new, empty Tendril
with a specified capacity.
Sourcepub fn reserve(&mut self, additional: u32)
pub fn reserve(&mut self, additional: u32)
Reserve space for additional bytes.
This is only a suggestion. There are cases where Tendril
will
decline to allocate until the buffer is actually modified.
Sourcepub fn len32(&self) -> u32
pub fn len32(&self) -> u32
Get the length of the Tendril
.
This is named not to conflict with len()
on the underlying
slice, if any.
Is the backing buffer shared?
Is the backing buffer shared with this other Tendril
?
Sourcepub fn try_from_byte_slice(x: &[u8]) -> Result<Tendril<F, A>, ()>
pub fn try_from_byte_slice(x: &[u8]) -> Result<Tendril<F, A>, ()>
Build a Tendril
by copying a byte slice, if it conforms to the format.
Sourcepub fn into_bytes(self) -> Tendril<Bytes, A> ⓘ
pub fn into_bytes(self) -> Tendril<Bytes, A> ⓘ
Convert into uninterpreted bytes.
Sourcepub fn into_send(self) -> SendTendril<F>
pub fn into_send(self) -> SendTendril<F>
Convert self
into a type which is Send
.
If the tendril is owned or inline, this is free, but if it’s shared this will entail a copy of the contents.
Sourcepub fn as_superset<Super>(&self) -> &Tendril<Super, A>
pub fn as_superset<Super>(&self) -> &Tendril<Super, A>
View as a superset format, for free.
Sourcepub fn into_superset<Super>(self) -> Tendril<Super, A>
pub fn into_superset<Super>(self) -> Tendril<Super, A>
Convert into a superset format, for free.
Sourcepub fn try_as_subset<Sub>(&self) -> Result<&Tendril<Sub, A>, ()>where
Sub: SubsetOf<F>,
pub fn try_as_subset<Sub>(&self) -> Result<&Tendril<Sub, A>, ()>where
Sub: SubsetOf<F>,
View as a subset format, if the Tendril
conforms to that subset.
Sourcepub fn try_into_subset<Sub>(self) -> Result<Tendril<Sub, A>, Tendril<F, A>>where
Sub: SubsetOf<F>,
pub fn try_into_subset<Sub>(self) -> Result<Tendril<Sub, A>, Tendril<F, A>>where
Sub: SubsetOf<F>,
Convert into a subset format, if the Tendril
conforms to that subset.
Sourcepub fn try_reinterpret_view<Other>(&self) -> Result<&Tendril<Other, A>, ()>where
Other: Format,
pub fn try_reinterpret_view<Other>(&self) -> Result<&Tendril<Other, A>, ()>where
Other: Format,
View as another format, if the bytes of the Tendril
are valid for
that format.
Sourcepub fn try_reinterpret<Other>(self) -> Result<Tendril<Other, A>, Tendril<F, A>>where
Other: Format,
pub fn try_reinterpret<Other>(self) -> Result<Tendril<Other, A>, Tendril<F, A>>where
Other: Format,
Convert into another format, if the Tendril
conforms to that format.
This only re-validates the existing bytes under the new format. It will not change the byte content of the tendril!
See the encode
and decode
methods for character encoding conversion.
Sourcepub fn try_push_bytes(&mut self, buf: &[u8]) -> Result<(), ()>
pub fn try_push_bytes(&mut self, buf: &[u8]) -> Result<(), ()>
Push some bytes onto the end of the Tendril
, if they conform to the
format.
Sourcepub fn push_tendril(&mut self, other: &Tendril<F, A>)
pub fn push_tendril(&mut self, other: &Tendril<F, A>)
Push another Tendril
onto the end of this one.
Sourcepub fn try_subtendril(
&self,
offset: u32,
length: u32,
) -> Result<Tendril<F, A>, SubtendrilError>
pub fn try_subtendril( &self, offset: u32, length: u32, ) -> Result<Tendril<F, A>, SubtendrilError>
Attempt to slice this Tendril
as a new Tendril
.
This will share the buffer when possible. Mutating a shared buffer will copy the contents.
The offset and length are in bytes. The function will return
Err
if these are out of bounds, or if the resulting slice
does not conform to the format.
Sourcepub fn subtendril(&self, offset: u32, length: u32) -> Tendril<F, A>
pub fn subtendril(&self, offset: u32, length: u32) -> Tendril<F, A>
Slice this Tendril
as a new Tendril
.
Panics on bounds or validity check failure.
Sourcepub fn try_pop_front(&mut self, n: u32) -> Result<(), SubtendrilError>
pub fn try_pop_front(&mut self, n: u32) -> Result<(), SubtendrilError>
Try to drop n
bytes from the front.
Returns Err
if the bytes are not available, or the suffix fails
validation.
Sourcepub fn pop_front(&mut self, n: u32)
pub fn pop_front(&mut self, n: u32)
Drop n
bytes from the front.
Panics if the bytes are not available, or the suffix fails validation.
Sourcepub fn try_pop_back(&mut self, n: u32) -> Result<(), SubtendrilError>
pub fn try_pop_back(&mut self, n: u32) -> Result<(), SubtendrilError>
Drop n
bytes from the back.
Returns Err
if the bytes are not available, or the prefix fails
validation.
Sourcepub fn pop_back(&mut self, n: u32)
pub fn pop_back(&mut self, n: u32)
Drop n
bytes from the back.
Panics if the bytes are not available, or the prefix fails validation.
Sourcepub unsafe fn reinterpret_view_without_validating<Other>(
&self,
) -> &Tendril<Other, A>where
Other: Format,
pub unsafe fn reinterpret_view_without_validating<Other>(
&self,
) -> &Tendril<Other, A>where
Other: Format,
View as another format, without validating.
Sourcepub unsafe fn reinterpret_without_validating<Other>(self) -> Tendril<Other, A>where
Other: Format,
pub unsafe fn reinterpret_without_validating<Other>(self) -> Tendril<Other, A>where
Other: Format,
Convert into another format, without validating.
Sourcepub unsafe fn from_byte_slice_without_validating(x: &[u8]) -> Tendril<F, A>
pub unsafe fn from_byte_slice_without_validating(x: &[u8]) -> Tendril<F, A>
Build a Tendril
by copying a byte slice, without validating.
Sourcepub unsafe fn push_bytes_without_validating(&mut self, buf: &[u8])
pub unsafe fn push_bytes_without_validating(&mut self, buf: &[u8])
Push some bytes onto the end of the Tendril
, without validating.
Sourcepub unsafe fn unsafe_subtendril(
&self,
offset: u32,
length: u32,
) -> Tendril<F, A>
pub unsafe fn unsafe_subtendril( &self, offset: u32, length: u32, ) -> Tendril<F, A>
Slice this Tendril
as a new Tendril
.
Does not check validity or bounds!
Sourcepub unsafe fn unsafe_pop_front(&mut self, n: u32)
pub unsafe fn unsafe_pop_front(&mut self, n: u32)
Drop n
bytes from the front.
Does not check validity or bounds!
Sourcepub unsafe fn unsafe_pop_back(&mut self, n: u32)
pub unsafe fn unsafe_pop_back(&mut self, n: u32)
Drop n
bytes from the back.
Does not check validity or bounds!
Trait Implementations
Source§impl<F, A> AsRef<<F as SliceFormat>::Slice> for Tendril<F, A>where
F: SliceFormat,
A: Atomicity,
impl<F, A> AsRef<<F as SliceFormat>::Slice> for Tendril<F, A>where
F: SliceFormat,
A: Atomicity,
Source§fn as_ref(&self) -> &<F as SliceFormat>::Slice
fn as_ref(&self) -> &<F as SliceFormat>::Slice
Source§impl<F, A> Deref for Tendril<F, A>where
F: SliceFormat,
A: Atomicity,
impl<F, A> Deref for Tendril<F, A>where
F: SliceFormat,
A: Atomicity,
Source§type Target = <F as SliceFormat>::Slice
type Target = <F as SliceFormat>::Slice
Source§fn deref(&self) -> &<F as SliceFormat>::Slice
fn deref(&self) -> &<F as SliceFormat>::Slice
Source§impl<F, A> DerefMut for Tendril<F, A>where
F: SliceFormat,
A: Atomicity,
impl<F, A> DerefMut for Tendril<F, A>where
F: SliceFormat,
A: Atomicity,
Source§fn deref_mut(&mut self) -> &mut <F as SliceFormat>::Slice
fn deref_mut(&mut self) -> &mut <F as SliceFormat>::Slice
Source§impl<'a, F, A> Extend<&'a Tendril<F, A>> for Tendril<F, A>
impl<'a, F, A> Extend<&'a Tendril<F, A>> for Tendril<F, A>
Source§fn extend<I>(&mut self, iterable: I)where
I: IntoIterator<Item = &'a Tendril<F, A>>,
fn extend<I>(&mut self, iterable: I)where
I: IntoIterator<Item = &'a Tendril<F, A>>,
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Source§impl<'a, A> Extend<&'a str> for Tendril<UTF8, A>where
A: Atomicity,
impl<'a, A> Extend<&'a str> for Tendril<UTF8, A>where
A: Atomicity,
Source§fn extend<I>(&mut self, iterable: I)where
I: IntoIterator<Item = &'a str>,
fn extend<I>(&mut self, iterable: I)where
I: IntoIterator<Item = &'a str>,
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Source§impl<A> Extend<char> for Tendril<UTF8, A>where
A: Atomicity,
impl<A> Extend<char> for Tendril<UTF8, A>where
A: Atomicity,
Source§fn extend<I>(&mut self, iterable: I)where
I: IntoIterator<Item = char>,
fn extend<I>(&mut self, iterable: I)where
I: IntoIterator<Item = char>,
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)