Struct rustls_ffi::rslice::rustls_str
source · [−]#[repr(C)]pub struct rustls_str<'a> {
pub data: *const c_char,
pub len: size_t,
/* private fields */
}Expand description
A read-only view on a Rust &str. The contents are guaranteed to be valid
UTF-8. As an additional guarantee on top of Rust’s normal UTF-8 guarantee,
a rustls_str is guaranteed not to contain internal NUL bytes, so it is
safe to interpolate into a C string or compare using strncmp. Keep in mind
that it is not NUL-terminated.
The memory exposed is available as specified by the function using this in its signature. For instance, when this is a parameter to a callback, the lifetime will usually be the duration of the callback. Functions that receive one of these must not dereference the data pointer beyond the allowed lifetime.
Fields
data: *const c_charlen: size_tImplementations
sourceimpl<'a> rustls_str<'a>
impl<'a> rustls_str<'a>
rustls_str represents a string that can be passed to C code. The string should not have any internal null bytes and is not null terminated. C code should not create rustls_str objects, they should only be created in Rust code.
pub fn from_str_unchecked(s: &'static str) -> rustls_str<'static>
Trait Implementations
sourceimpl<'a> Debug for rustls_str<'a>
impl<'a> Debug for rustls_str<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for rustls_str<'a>
impl<'a> !Send for rustls_str<'a>
impl<'a> !Sync for rustls_str<'a>
impl<'a> Unpin for rustls_str<'a>
impl<'a> UnwindSafe for rustls_str<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more