Struct cros_tracing_types::static_strings::StaticString
source · 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_char
Implementations§
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§
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