Struct string_box::StringBox
source · [−]pub struct StringBox { /* private fields */ }
Implementations
sourceimpl StringBox
impl StringBox
pub fn new() -> Self
sourcepub fn from_string(string: String) -> Self
pub fn from_string(string: String) -> Self
Create from Rust string
sourcepub unsafe fn from_byte_string_data(data: *const u8, length: usize) -> Self
pub unsafe fn from_byte_string_data(data: *const u8, length: usize) -> Self
Create from a wide string by copying the data
sourcepub fn from_byte_string(data: Vec<u8>) -> Self
pub fn from_byte_string(data: Vec<u8>) -> Self
Create from a byte string vector
sourcepub unsafe fn from_utf8_string_data(data: *const u8, length: usize) -> Self
pub unsafe fn from_utf8_string_data(data: *const u8, length: usize) -> Self
data must be nul terminated length does not take nul into account
sourcepub fn from_utf8_string(data: &[u8]) -> Self
pub fn from_utf8_string(data: &[u8]) -> Self
data must be nul terminated length does not take nul into account
sourcepub fn set_string(&mut self, string: String)
pub fn set_string(&mut self, string: String)
Replace the string with a given instance
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the length of this String
, in bytes, not char
s or
graphemes. In other words, it may not be what a human considers the
length of the string.
sourcepub fn char_count(&self) -> usize
pub fn char_count(&self) -> usize
Returns the amount of char
pub fn to_string(&self) -> String
pub fn as_str(&self) -> &str
pub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
pub fn as_ptr(&self) -> *const u8
pub fn char_index_to_byte_range(&self, index: usize) -> Range<usize>
pub fn char_index_to_utf16_range(&self, index: usize) -> Range<usize>
pub fn utf16_position_to_char_index(&self, index: usize) -> usize
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for StringBox
impl Send for StringBox
impl Sync for StringBox
impl Unpin for StringBox
impl UnwindSafe for StringBox
Blanket Implementations
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