pub struct Utf8CString {
string: Box<CStr>,
}
Expand description
A string that is guaranteed to be UTF-8 and NUL-terminated, for fast access as either type.
Fields§
§string: Box<CStr>
The body of this string.
§Safety
INVARIANT: This string must be valid UTF-8.
(We do not yet depend on this invariant for safety in our rust code, but we do promise in our C ffi that it will hold.)
Implementations§
Source§impl Utf8CString
impl Utf8CString
Source§impl Utf8CString
impl Utf8CString
Sourcefn try_from_bytes(bytes: &[u8]) -> Result<Self, Utf8CStringFromBytesError>
fn try_from_bytes(bytes: &[u8]) -> Result<Self, Utf8CStringFromBytesError>
Try to construct a new Utf8CString
from a given byte slice.
Trait Implementations§
Source§impl AsRef<CStr> for Utf8CString
impl AsRef<CStr> for Utf8CString
Source§impl AsRef<str> for Utf8CString
impl AsRef<str> for Utf8CString
Source§impl Clone for Utf8CString
impl Clone for Utf8CString
Source§fn clone(&self) -> Utf8CString
fn clone(&self) -> Utf8CString
Returns a duplicate 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 Utf8CString
impl Debug for Utf8CString
Source§impl<'de> Deserialize<'de> for Utf8CString
impl<'de> Deserialize<'de> for Utf8CString
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for Utf8CString
impl Display for Utf8CString
Source§impl From<ErrorResponse> for Utf8CString
impl From<ErrorResponse> for Utf8CString
Source§fn from(value: ErrorResponse) -> Self
fn from(value: ErrorResponse) -> Self
Converts to this type from the input type.
Source§impl From<ObjectId> for Utf8CString
impl From<ObjectId> for Utf8CString
Source§impl From<SuccessResponse> for Utf8CString
impl From<SuccessResponse> for Utf8CString
Source§fn from(value: SuccessResponse) -> Self
fn from(value: SuccessResponse) -> Self
Converts to this type from the input type.
Source§impl From<UpdateResponse> for Utf8CString
impl From<UpdateResponse> for Utf8CString
Source§fn from(value: UpdateResponse) -> Self
fn from(value: UpdateResponse) -> Self
Converts to this type from the input type.
Source§impl From<Utf8CString> for ObjectId
impl From<Utf8CString> for ObjectId
Source§fn from(value: Utf8CString) -> Self
fn from(value: Utf8CString) -> Self
Converts to this type from the input type.
Source§impl Hash for Utf8CString
impl Hash for Utf8CString
Source§impl Ord for Utf8CString
impl Ord for Utf8CString
Source§fn cmp(&self, other: &Utf8CString) -> Ordering
fn cmp(&self, other: &Utf8CString) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for Utf8CString
impl PartialEq for Utf8CString
Source§impl PartialOrd for Utf8CString
impl PartialOrd for Utf8CString
Source§impl Serialize for Utf8CString
impl Serialize for Utf8CString
Source§impl TryFrom<String> for Utf8CString
impl TryFrom<String> for Utf8CString
impl Eq for Utf8CString
impl StructuralPartialEq for Utf8CString
Auto Trait Implementations§
impl Freeze for Utf8CString
impl RefUnwindSafe for Utf8CString
impl Send for Utf8CString
impl Sync for Utf8CString
impl Unpin for Utf8CString
impl UnwindSafe for Utf8CString
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§impl<T> AsUncased for T
impl<T> AsUncased for T
§fn as_uncased(&self) -> &UncasedStr
fn as_uncased(&self) -> &UncasedStr
Convert
self
to an [UncasedStr
].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,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more