pub struct String<const N: usize> { /* private fields */ }Implementations
sourceimpl<const N: usize> String<N>
impl<const N: usize> String<N>
pub fn new() -> String<N>
pub fn volatile_clear(&mut self)
pub fn from_str<T>(src: T) -> String<N>where
T: AsRef<str>,
pub fn as_bytes(&self) -> [u8; N]
pub fn as_str(&self) -> Result<&str, Utf8Error>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
sourcepub fn from_message(message: &MemoryMessage) -> Result<String<N>, Utf8Error>
pub fn from_message(message: &MemoryMessage) -> Result<String<N>, Utf8Error>
Convert a MemoryMessage into a String
sourcepub fn lend(&self, connection: CID) -> Result<Result, Error>
pub fn lend(&self, connection: CID) -> Result<Result, Error>
Perform an immutable lend of this String to the specified server. This function will block until the server returns. Note that this convenience should only be used if the server only ever expects to deal with one type of String, ever. Otherwise, this should be implemented in the API and wrapped in an Enum to help decorate the functional target of the string. An example of a server that uses this convencience function is the logger.
sourcepub fn send(self, connection: CID) -> Result<Result, Error>
pub fn send(self, connection: CID) -> Result<Result, Error>
Move this string from the client into the server.
pub fn to_str(&self) -> &str
sourcepub fn pop(&mut self) -> Option<char>
pub fn pop(&mut self) -> Option<char>
awful, O(N) implementation because we have to iterate through the entire string and decode variable-length utf8 characters, until we can’t.
pub fn push(&mut self, ch: char) -> Result<usize, Error>
pub fn append(&mut self, s: &str) -> Result<usize, Error>
pub fn push_byte(&mut self, b: u8) -> Result<(), Error>
Trait Implementations
sourceimpl<const N: usize> Archive for String<N>
impl<const N: usize> Archive for String<N>
Turn a String into an archived object
type Archived = ArchivedString
type Archived = ArchivedString
The archived version of this type.
type Resolver = StringResolver
type Resolver = StringResolver
The resolver for this type. It must contain all the information needed
to make the archived type from the normal type. Read more
sourceimpl<D: Fallible + ?Sized, const N: usize> Deserialize<String<N>, D> for ArchivedString
impl<D: Fallible + ?Sized, const N: usize> Deserialize<String<N>, D> for ArchivedString
sourceimpl<const N: usize> PartialEq<String<N>> for String<N>
impl<const N: usize> PartialEq<String<N>> for String<N>
sourceimpl<const N: usize> Write for String<N>
impl<const N: usize> Write for String<N>
impl<const N: usize> Copy for String<N>
impl<const N: usize> Eq for String<N>
Auto Trait Implementations
impl<const N: usize> RefUnwindSafe for String<N>
impl<const N: usize> Send for String<N>
impl<const N: usize> Sync for String<N>
impl<const N: usize> Unpin for String<N>
impl<const N: usize> UnwindSafe for String<N>
Blanket Implementations
sourceimpl<T> ArchivePointee for T
impl<T> ArchivePointee for T
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
sourcefn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
sourceimpl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
The archived counterpart of this type. Unlike
Archive, it may be
unsized. Read moretype MetadataResolver = ()
type MetadataResolver = ()
The resolver for the metadata of this type.
sourcefn resolve_metadata(
&self,
usize,
<T as ArchiveUnsized>::MetadataResolver
) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
fn resolve_metadata(
&self,
usize,
<T as ArchiveUnsized>::MetadataResolver
) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
Creates the archived version of the metadata for this value at the given
position. Read more
sourceunsafe fn resolve_unsized(
&self,
from: usize,
to: usize,
resolver: Self::MetadataResolver
) -> RelPtr<Self::Archived>
unsafe fn resolve_unsized(
&self,
from: usize,
to: usize,
resolver: Self::MetadataResolver
) -> RelPtr<Self::Archived>
sourceimpl<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
sourceimpl<T, S> SerializeUnsized<S> for Twhere
T: Serialize<S>,
S: Serializer + ?Sized,
impl<T, S> SerializeUnsized<S> for Twhere
T: Serialize<S>,
S: Serializer + ?Sized,
sourcefn serialize_unsized(
&self,
serializer: &mut S
) -> Result<usize, <S as Fallible>::Error>
fn serialize_unsized(
&self,
serializer: &mut S
) -> Result<usize, <S as Fallible>::Error>
Writes the object and returns the position of the archived type.
sourcefn serialize_metadata(
&self,
&mut S
) -> Result<<<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata, <S as Fallible>::Error>
fn serialize_metadata(
&self,
&mut S
) -> Result<<<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata, <S as Fallible>::Error>
Serializes the metadata for the given type.