Struct xous::stringbuffer::StringBuffer
source · pub struct StringBuffer<'a> { /* private fields */ }Expand description
A buffered String suitable for sending across as a message
Implementations§
source§impl<'a> StringBuffer<'a>
impl<'a> StringBuffer<'a>
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new StringBuffer with no backing. This will get resized as soon as data is written to it.
sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a new StringBuffer with enough space to hold
usize characters
pub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes_mut(&mut self) -> &mut [u8] ⓘ
pub fn as_str(&self) -> Result<&str, Utf8Error>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn to_str(&self) -> &str
sourcepub unsafe fn from_memory_message(mem: &'a MemoryMessage) -> Self
pub unsafe fn from_memory_message(mem: &'a MemoryMessage) -> Self
Safety
This can turn any MemoryMessage into a StringBuffer, so ensure
that this function is only called when the contents are a StringBuffer
sourcepub unsafe fn from_memory_message_mut(mem: &'a mut MemoryMessage) -> Self
pub unsafe fn from_memory_message_mut(mem: &'a mut MemoryMessage) -> Self
Safety
This can turn any MemoryMessage into a StringBuffer, so ensure
that this function is only called when the contents are a StringBuffer
sourcepub fn lend_mut(&mut self, connection: CID, id: u32) -> Result<Result, Error>
pub fn lend_mut(&mut self, connection: CID, id: u32) -> Result<Result, Error>
Perform a mutable lend of this String to the server.