Struct xous_ipc::String

source ·
pub struct String<const N: usize> { /* private fields */ }

Implementations§

source§

impl<const N: usize> String<N>

source

pub fn new() -> String<N>

source

pub fn volatile_clear(&mut self)

source

pub fn from_str<T>(src: T) -> String<N>
where T: AsRef<str>,

source

pub fn as_bytes(&self) -> [u8; N]

source

pub fn as_str(&self) -> Result<&str, Utf8Error>

source

pub fn len(&self) -> usize

source

pub fn is_empty(&self) -> bool

source

pub fn from_message(message: &MemoryMessage) -> Result<String<N>, Utf8Error>

Convert a MemoryMessage into a String

source

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.

source

pub fn send(self, connection: CID) -> Result<Result, Error>

Move this string from the client into the server.

source

pub fn clear(&mut self)

Clear the contents of this String and set the length to 0

source

pub fn to_str(&self) -> &str

source

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.

source

pub fn push(&mut self, ch: char) -> Result<usize, Error>

source

pub fn append(&mut self, s: &str) -> Result<usize, Error>

source

pub fn push_byte(&mut self, b: u8) -> Result<(), Error>

Trait Implementations§

source§

impl<const N: usize> Archive for String<N>

Turn a String into an archived object

§

type Archived = ArchivedString

The archived version of this type.
§

type Resolver = StringResolver

The resolver for this type. It must contain all the information needed to make the archived type from the normal type.
source§

fn resolve(&self, pos: usize, resolver: Self::Resolver) -> Self::Archived

Creates the archived version of this value at the given position.
source§

impl<const N: usize> AsRef<str> for String<N>

source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<const N: usize> Clone for String<N>

source§

fn clone(&self) -> String<N>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<const N: usize> Debug for String<N>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<const N: usize> Default for String<N>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<D: Fallible + ?Sized, const N: usize> Deserialize<String<N>, D> for ArchivedString

source§

fn deserialize(&self, _deserializer: &mut D) -> Result<String<N>, D::Error>

Deserializes using the given deserializer
source§

impl<const N: usize> Display for String<N>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<const N: usize> PartialEq for String<N>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<S: Serializer + ?Sized, const N: usize> Serialize<S> for String<N>

source§

fn serialize(&self, serializer: &mut S) -> Result<Self::Resolver, S::Error>

Writes the dependencies for the object and returns a resolver that can create the archived type.
source§

impl<const N: usize> Write for String<N>

source§

fn write_str(&mut self, s: &str) -> Result<(), Error>

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0 · source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more
source§

impl<const N: usize> Copy for String<N>

source§

impl<const N: usize> Eq for String<N>

Auto Trait Implementations§

§

impl<const N: usize> Freeze for String<N>

§

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§

source§

impl<T> Any for T
where 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> ArchiveUnsized for T
where T: Archive,

§

type Archived = <T as Archive>::Archived

The archived counterpart of this type. Unlike Archive, it may be unsized.
§

type MetadataResolver = ()

The resolver for the metadata of this type.
source§

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.
source§

unsafe fn resolve_unsized( &self, from: usize, to: usize, resolver: Self::MetadataResolver ) -> RelPtr<Self::Archived>

Resolves a relative pointer to this value with the given from and to. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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> Pointee for T

§

type Metadata = ()

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

impl<T, S> SerializeUnsized<S> for T
where T: Serialize<S>, S: Serializer + ?Sized,

source§

fn serialize_unsized( &self, serializer: &mut S ) -> Result<usize, <S as Fallible>::Error>

Writes the object and returns the position of the archived type.
source§

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.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.