#[repr(C)]pub struct NrStr {
pub ptr: *const u8,
pub len: u32,
pub _reserved: u32,
}Expand description
A UTF-8 string slice with a pointer and length.
This struct is #[repr(C)] and ABI-stable.
On 64-bit targets _reserved occupies the four bytes after len that
would otherwise be implicit padding. Producers must set it to zero.
Fields§
§ptr: *const u8§len: u32§_reserved: u32Implementations§
Source§impl NrStr
impl NrStr
Sourcepub fn new(s: &str) -> Self
pub fn new(s: &str) -> Self
Creates a borrowed ABI string view.
The returned value must not be used to access the string after s is
invalidated. Use NrStr::as_str only while the source is alive.
Sourcepub const fn from_static(s: &'static str) -> Self
pub const fn from_static(s: &'static str) -> Self
Creates a borrowed ABI view from a static string.
Trait Implementations§
impl Copy for NrStr
impl Send for NrStr
impl Sync for NrStr
Auto Trait Implementations§
impl Freeze for NrStr
impl RefUnwindSafe for NrStr
impl Unpin for NrStr
impl UnsafeUnpin for NrStr
impl UnwindSafe for NrStr
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