#[repr(C)]pub struct RelString<A: RawRegionalAllocator, B: Basis = DefaultBasis> { /* private fields */ }
Expand description
A relative counterpart to String
.
Implementations
sourceimpl<A: RawRegionalAllocator, B: Basis> RelString<A, B>
impl<A: RawRegionalAllocator, B: Basis> RelString<A, B>
sourcepub fn allocator(this: Ref<'_, Self>) -> Ref<'_, A>
pub fn allocator(this: Ref<'_, Self>) -> Ref<'_, A>
Returns a reference to the underlying allocator.
sourcepub fn as_bytes(this: Ref<'_, Self>) -> Ref<'_, [u8]>
pub fn as_bytes(this: Ref<'_, Self>) -> Ref<'_, [u8]>
Returns a bytes slice of this RelString
’s contents.
sourcepub fn as_str(this: Ref<'_, Self>) -> Ref<'_, str>
pub fn as_str(this: Ref<'_, Self>) -> Ref<'_, str>
Returns a string slice of the RelString
’s contents.
sourcepub unsafe fn as_mut_vec(this: Mut<'_, Self>) -> Mut<'_, RelVec<u8, A, B>>
pub unsafe fn as_mut_vec(this: Mut<'_, Self>) -> Mut<'_, RelVec<u8, A, B>>
Returns a mutable reference to the contents of this RelString
.
Safety
The returned Mut<'_, RelVec<u8, A, B>>
allows writing bytes which are
not valid UTF-8. If this constraint is violated, using the original
RelString
after dropping the Mut
may violate memory safety, as other
code may assume that RelStrings
only contain valid UTF-8.
sourcepub fn as_mut_str(this: Mut<'_, Self>) -> Mut<'_, str>
pub fn as_mut_str(this: Mut<'_, Self>) -> Mut<'_, str>
Returns a mutable string slice of the RelString
’s contents.
sourcepub fn clear(this: Mut<'_, Self>)
pub fn clear(this: Mut<'_, Self>)
Truncates this RelString
, removing all contents.
While this means the String
will have a length of zero, it does not
affect its capacity.
Trait Implementations
sourceimpl<A: RawRegionalAllocator, B: Basis> DebugRaw for RelString<A, B>
impl<A: RawRegionalAllocator, B: Basis> DebugRaw for RelString<A, B>
sourceimpl<A: RawRegionalAllocator, B: Basis> DerefRaw for RelString<A, B>
impl<A: RawRegionalAllocator, B: Basis> DerefRaw for RelString<A, B>
sourceimpl<A: RawRegionalAllocator, B: Basis> DisplayRaw for RelString<A, B>
impl<A: RawRegionalAllocator, B: Basis> DisplayRaw for RelString<A, B>
sourceimpl<A: RawRegionalAllocator, B: Basis> DropRaw for RelString<A, B>where
RelVec<u8, A, B>: DropRaw,
impl<A: RawRegionalAllocator, B: Basis> DropRaw for RelString<A, B>where
RelVec<u8, A, B>: DropRaw,
sourceimpl<A, B, R> Emplace<RelString<A, B>, <R as RegionalAllocator>::Region> for Clone<'_, R>where
A: DropRaw + RawRegionalAllocator<Region = R::Region>,
B: Basis,
R: RelAllocator<A>,
impl<A, B, R> Emplace<RelString<A, B>, <R as RegionalAllocator>::Region> for Clone<'_, R>where
A: DropRaw + RawRegionalAllocator<Region = R::Region>,
B: Basis,
R: RelAllocator<A>,
sourceimpl<A: RawRegionalAllocator, B: Basis, __R: Region> Move<__R> for RelString<A, B>where
Self: DropRaw,
RelVec<u8, A, B>: Move<__R>,
impl<A: RawRegionalAllocator, B: Basis, __R: Region> Move<__R> for RelString<A, B>where
Self: DropRaw,
RelVec<u8, A, B>: Move<__R>,
impl<A: RawRegionalAllocator, B: Basis> Portable for RelString<A, B>where
RelVec<u8, A, B>: Portable,
Auto Trait Implementations
impl<A, B> RefUnwindSafe for RelString<A, B>where
A: RefUnwindSafe,
<B as Basis>::Isize: RefUnwindSafe,
<A as RawRegionalAllocator>::Region: RefUnwindSafe,
<B as Basis>::Usize: RefUnwindSafe,
impl<A, B = DefaultBasis> !Send for RelString<A, B>
impl<A, B = DefaultBasis> !Sync for RelString<A, B>
impl<A, B = DefaultBasis> !Unpin for RelString<A, B>
impl<A, B> UnwindSafe for RelString<A, B>where
A: UnwindSafe,
<B as Basis>::Isize: UnwindSafe,
<A as RawRegionalAllocator>::Region: UnwindSafe,
<B as Basis>::Usize: UnwindSafe,
Blanket Implementations
sourceimpl<T, B> BasisPointee<B> for Twhere
B: Basis,
impl<T, B> BasisPointee<B> for Twhere
B: Basis,
type BasisMetadata = ()
type BasisMetadata = ()
The metadata associated with the pointee in the chosen basis.
type FromNativeError = Infallible
type FromNativeError = Infallible
An error occurred while converting metadata from the native
representation. Read more
type ToNativeError = Infallible
type ToNativeError = Infallible
An error occurred while converting metadata to the native
representation. Read more
sourcefn from_native_metadata(
<T as Pointee>::Metadata
) -> Result<<T as BasisPointee<B>>::BasisMetadata, <T as BasisPointee<B>>::FromNativeError>
fn from_native_metadata(
<T as Pointee>::Metadata
) -> Result<<T as BasisPointee<B>>::BasisMetadata, <T as BasisPointee<B>>::FromNativeError>
Returns the pointer metadata in
B
corresponding to the given native
pointer metadata, or Err
if the conversion failed. Read moresourcefn to_native_metadata(
<T as BasisPointee<B>>::BasisMetadata
) -> Result<<T as Pointee>::Metadata, <T as BasisPointee<B>>::ToNativeError>
fn to_native_metadata(
<T as BasisPointee<B>>::BasisMetadata
) -> Result<<T as Pointee>::Metadata, <T as BasisPointee<B>>::ToNativeError>
Returns the native pointer metadata corresponding to the given pointer
metadata in
B
, or Err
if the conversion failed. Read moresourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more