#[repr(C)]pub struct StringBox { /* private fields */ }
Implementations§
Source§impl 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_wide_string_data(data: *const u32, length: usize) -> Self
pub unsafe fn from_wide_string_data(data: *const u32, length: usize) -> Self
Create from a wide string by copying the data
Sourcepub fn from_wide_string(data: Vec<u32>) -> Self
pub fn from_wide_string(data: Vec<u32>) -> Self
Create from a wide string vector
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] ⓘ
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 Freeze for StringBox
impl RefUnwindSafe for StringBox
impl Send for StringBox
impl Sync for StringBox
impl Unpin for StringBox
impl UnwindSafe for StringBox
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