Struct arcdps_imgui::ImString
source · pub struct ImString(/* private fields */);
Expand description
A UTF-8 encoded, growable, implicitly nul-terminated string.
Implementations§
source§impl ImString
impl ImString
sourcepub fn new<T: Into<String>>(value: T) -> ImString
pub fn new<T: Into<String>>(value: T) -> ImString
Creates a new ImString
from an existing string.
sourcepub fn with_capacity(capacity: usize) -> ImString
pub fn with_capacity(capacity: usize) -> ImString
Creates a new empty ImString
with a particular capacity
sourcepub unsafe fn from_utf8_unchecked(v: Vec<u8>) -> ImString
pub unsafe fn from_utf8_unchecked(v: Vec<u8>) -> ImString
Converts a vector of bytes to a ImString
without checking that the string contains valid
UTF-8
§Safety
It is up to the caller to guarantee the vector contains valid UTF-8 and no null terminator.
sourcepub unsafe fn from_utf8_with_nul_unchecked(v: Vec<u8>) -> ImString
pub unsafe fn from_utf8_with_nul_unchecked(v: Vec<u8>) -> ImString
Converts a vector of bytes to a ImString
without checking that the string contains valid
UTF-8
§Safety
It is up to the caller to guarantee the vector contains valid UTF-8 and a null terminator.
sourcepub fn push_str(&mut self, string: &str)
pub fn push_str(&mut self, string: &str)
Appends a given string slice to the end of this ImString
sourcepub fn capacity_with_nul(&self) -> usize
pub fn capacity_with_nul(&self) -> usize
Returns the capacity of this ImString
in bytes, including the implicit null byte
sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Ensures that the capacity of this ImString
is at least additional
bytes larger than the
current length.
The capacity may be increased by more than additional
bytes.
sourcepub fn reserve_exact(&mut self, additional: usize)
pub fn reserve_exact(&mut self, additional: usize)
Ensures that the capacity of this ImString
is at least additional
bytes larger than the
current length
sourcepub fn as_mut_ptr(&mut self) -> *mut c_char
pub fn as_mut_ptr(&mut self) -> *mut c_char
Returns a raw mutable pointer to the underlying buffer.
If the underlying data is modified, refresh_len
must be called afterwards.
sourcepub unsafe fn refresh_len(&mut self)
pub unsafe fn refresh_len(&mut self)
Updates the underlying buffer length based on the current contents.
This function must be called if the underlying data is modified via a pointer
obtained by as_mut_ptr
.
§Safety
It is up to the caller to guarantee the this ImString contains valid UTF-8 and a null terminator.
Methods from Deref<Target = ImStr>§
Trait Implementations§
source§impl Ord for ImString
impl Ord for ImString
source§impl PartialEq for ImString
impl PartialEq for ImString
source§impl PartialOrd for ImString
impl PartialOrd for ImString
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more