pub union ArchivedStringRepr {
    /* private fields */
}
Expand description

An archived string representation that can inline short strings.

Implementations§

source§

impl ArchivedStringRepr

source

pub fn is_inline(&self) -> bool

Returns whether the representation is inline.

source

pub unsafe fn out_of_line_offset(&self) -> isize

Returns the offset of the representation.

Safety

The internal representation must be out-of-line.

source

pub fn as_ptr(&self) -> *const u8

Returns a pointer to the bytes of the string.

source

pub fn as_mut_ptr(&mut self) -> *mut u8

Returns a mutable pointer to the bytes of the string.

source

pub fn len(&self) -> usize

Returns the length of the string.

source

pub fn is_empty(&self) -> bool

Returns whether the string is empty.

source

pub fn as_str_ptr(&self) -> *const str

Returns a pointer to the string as a str.

source

pub fn bytes(&self) -> &[u8]

Returns a slice of the bytes of the string.

source

pub fn bytes_mut(&mut self) -> &mut [u8]

Returns a mutable slice of the bytes of the string.

source

pub fn as_str(&self) -> &str

Returns a reference to the string as a str.

source

pub fn as_mut_str(&mut self) -> &mut str

Returns a mutable reference to the string as a str.

source

pub unsafe fn emplace_inline(value: &str, out: *mut Self)

Emplaces a new inline representation for the given str.

Safety
  • The length of str must be less than or equal to INLINE_CAPACITY.
  • out must point to a valid location to write the inline representation.
source

pub unsafe fn emplace_out_of_line( value: &str, pos: usize, target: usize, out: *mut Self )

Emplaces a new out-of-line representation for the given str.

Safety
  • The length of str must be greater than INLINE_CAPACITY.
  • pos must be the location of the representation within the archive.
  • target must be the location of the serialized bytes of the string.
  • out must point to a valid location to write the out-of-line representation.

Trait Implementations§

source§

impl<C: Fallible + ?Sized> CheckBytes<C> for ArchivedStringRepr

§

type Error = CheckStringReprError

The error that may result from checking the type.
source§

unsafe fn check_bytes<'a>( value: *const Self, _: &mut C ) -> Result<&'a Self, Self::Error>

Checks whether the given pointer points to a valid value within the given context. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

source§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> LayoutRaw for T

source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
source§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.