pub struct StaticString(*const c_char);Expand description
Holds a reference to a ’static string that was registered via register_string.
Tuple Fields§
§0: *const c_charImplementations§
Source§impl StaticString
impl StaticString
pub fn as_ptr(&self) -> *const c_char
Sourcepub fn register(str: &str) -> Self
pub fn register(str: &str) -> Self
Turns a given string into a *c_char which has static lifetime measured from the moment this function returns. Registering the same string multiple times behaves like interning (will not use additional resources).
WARNING: this function creates data with static lifetime. It should only be called on a finite set of unique strings. Using it on a non-finite set will appear to be a memory leak since the space used will grow without bound.
Trait Implementations§
Source§impl Clone for StaticString
impl Clone for StaticString
Source§fn clone(&self) -> StaticString
fn clone(&self) -> StaticString
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for StaticString
impl Send for StaticString
impl Sync for StaticString
Auto Trait Implementations§
impl Freeze for StaticString
impl RefUnwindSafe for StaticString
impl Unpin for StaticString
impl UnwindSafe for StaticString
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