pub struct ArchivedString { /* private fields */ }Available on crate feature
archive only.Expand description
The archived form of a UTF-8 string.
Body layout: u32 byte_len followed by UTF-8 bytes.
Relative pointers are tied to their address and must not be copied out.
ⓘ
use rustbinary::archive_codec::ArchivedString;
fn relocate(value: &ArchivedString) -> ArchivedString { *value }Implementations§
Source§impl ArchivedString
impl ArchivedString
Sourcepub unsafe fn as_str_unchecked(&self) -> &str
pub unsafe fn as_str_unchecked(&self) -> &str
Resolves the string from the field’s own address.
§Safety
The archive must have been validated with CheckBytes and the
backing buffer must be immutable for the returned borrow.
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the string (requires prior CheckBytes).
Sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
Returns the raw UTF-8 bytes (requires prior CheckBytes).
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the byte length (requires prior CheckBytes).
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether the string is empty (requires prior CheckBytes).
Trait Implementations§
impl ArchivedValue for ArchivedString
Auto Trait Implementations§
impl Forget for ArchivedString
impl Freeze for ArchivedString
impl RefUnwindSafe for ArchivedString
impl Send for ArchivedString
impl Sync for ArchivedString
impl Unpin for ArchivedString
impl UnsafeUnpin for ArchivedString
impl UnwindSafe for ArchivedString
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