pub struct NullString { /* private fields */ }
Expand description
A wrapper for a 'static
null-terminated string.
Sometimes used in favor of
CStr
or CString
,
as NullString
s can be made as compile-time constants.
Implementations§
Source§impl NullString
impl NullString
Sourcepub const fn new(s: &'static str) -> NullString
pub const fn new(s: &'static str) -> NullString
Creates a NullString
from s
or panics if s
is not null-terminated.
§Panics
Panics if the string s
does not end in the null character.
Trait Implementations§
Source§impl AsRef<CStr> for NullString
impl AsRef<CStr> for NullString
Source§impl Clone for NullString
impl Clone for NullString
Source§fn clone(&self) -> NullString
fn clone(&self) -> NullString
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 moreSource§impl Debug for NullString
impl Debug for NullString
Source§impl From<&'static CStr> for NullString
impl From<&'static CStr> for NullString
Source§impl From<NullString> for &'static CStr
impl From<NullString> for &'static CStr
Source§fn from(nstr: NullString) -> Self
fn from(nstr: NullString) -> Self
Converts to this type from the input type.
Source§impl PrintfArgument for NullString
impl PrintfArgument for NullString
Source§const IS_C_STRING: bool = true
const IS_C_STRING: bool = true
Whether the type is a null-terminated string.
Source§type CPrintfType = *const i8
type CPrintfType = *const i8
The C type corresponding to
Self
that we should really send
as an argument to a printf(3)
-like function.Source§fn as_c_val(self) -> *const c_char
fn as_c_val(self) -> *const c_char
Converts
self
to a value suitable for sending to printf(3)
.Source§const IS_LONG_LONG: bool = false
const IS_LONG_LONG: bool = false
Whether the type is consistent with C’s
long long int
.Source§const IS_SIZE: bool = false
const IS_SIZE: bool = false
Available on crate feature
libc
only.Whether the type is consistent with C’s
size_t
.Source§const IS_MAX: bool = false
const IS_MAX: bool = false
Available on crate feature
libc
only.Whether the type is consistent with C’s
intmax_t
.Source§const IS_PTRDIFF: bool = false
const IS_PTRDIFF: bool = false
Available on crate feature
libc
only.Whether the type is consistent with C’s
ptrdiff_t
.Source§const IS_SIGNED: bool = false
const IS_SIGNED: bool = false
Whether the type is a signed integer type, as opposed to unsigned.
Source§const IS_POINTER: bool = false
const IS_POINTER: bool = false
Whether the type is a pointer.
impl Copy for NullString
impl Send for NullString
impl Sync for NullString
Auto Trait Implementations§
impl Freeze for NullString
impl RefUnwindSafe for NullString
impl Unpin for NullString
impl UnwindSafe for NullString
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> PrintfArgs for Twhere
T: PrintfArgument,
impl<T> PrintfArgs for Twhere
T: PrintfArgument,
Source§type AsList = (T, ())
type AsList = (T, ())
The
PrintfArgsList
equivalent to Self
.