#[repr(transparent)]pub struct StringWrapper<T> {
pub inner: T,
}
Expand description
Since the compiler will complain that upstream crates may add a new impl
of trait *** for type {I}
, we have to wrap it with newtype.
Just StrWrapper::from
.
For Arc<str>
, etc, use StrWrapper
since it just implements Deref<Target = str>
but not Deref<Target = String>
.
This is an auto-generated wrapper over T
Fields§
§inner: T
Inner value
Implementations§
Source§impl<T> StringWrapper<T>
impl<T> StringWrapper<T>
Sourcepub const fn new(inner: T) -> Self
pub const fn new(inner: T) -> Self
Creates a new instance of StringWrapper
Trait Implementations§
Source§impl<T> AsRef<T> for StringWrapper<T>
impl<T> AsRef<T> for StringWrapper<T>
Source§impl<T> Borrow<T> for StringWrapper<T>
impl<T> Borrow<T> for StringWrapper<T>
Source§impl<T: Clone> Clone for StringWrapper<T>
impl<T: Clone> Clone for StringWrapper<T>
Source§fn clone(&self) -> StringWrapper<T>
fn clone(&self) -> StringWrapper<T>
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<T: Debug> Debug for StringWrapper<T>
impl<T: Debug> Debug for StringWrapper<T>
Source§impl<T> Deref for StringWrapper<T>
impl<T> Deref for StringWrapper<T>
Source§impl<T> DerefMut for StringWrapper<T>
impl<T> DerefMut for StringWrapper<T>
Source§impl<T> From<T> for StringWrapper<T>
impl<T> From<T> for StringWrapper<T>
Source§impl<T: Hash> Hash for StringWrapper<T>
impl<T: Hash> Hash for StringWrapper<T>
Source§impl<T: Ord> Ord for StringWrapper<T>
impl<T: Ord> Ord for StringWrapper<T>
Source§fn cmp(&self, other: &StringWrapper<T>) -> Ordering
fn cmp(&self, other: &StringWrapper<T>) -> 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<T: PartialEq> PartialEq for StringWrapper<T>
impl<T: PartialEq> PartialEq for StringWrapper<T>
Source§impl<T: PartialOrd> PartialOrd for StringWrapper<T>
impl<T: PartialOrd> PartialOrd for StringWrapper<T>
Source§impl<T> StringExtT for StringWrapper<T>
impl<T> StringExtT for StringWrapper<T>
Source§fn with_prefix<P: StringExtT + Copy>(self, prefix: P) -> impl StringExtT
fn with_prefix<P: StringExtT + Copy>(self, prefix: P) -> impl StringExtT
With prefix.
Source§fn with_suffix<S: StringExtT + Copy>(self, suffix: S) -> impl StringExtT
fn with_suffix<S: StringExtT + Copy>(self, suffix: S) -> impl StringExtT
With suffix.
Source§fn to_string_ext(self) -> String
fn to_string_ext(self) -> String
Encode the value to the string.
Source§fn to_string_ext_with_separator(self, separator: &str) -> String
fn to_string_ext_with_separator(self, separator: &str) -> String
Encode the value(s) to the string with separator.
Source§fn to_http_header_value(self) -> Result<HeaderValue, InvalidHeaderValue>
fn to_http_header_value(self) -> Result<HeaderValue, InvalidHeaderValue>
Encode the value to the string as a HTTP header value.
Source§impl<T> StringT for StringWrapper<T>
impl<T> StringT for StringWrapper<T>
Source§fn encode_to_buf(self, string: &mut Vec<u8>)
fn encode_to_buf(self, string: &mut Vec<u8>)
Push the value to the string (the underlying
Vec<u8>
).Source§fn encode_to_buf_with_separator(self, string: &mut Vec<u8>, separator: &str)
fn encode_to_buf_with_separator(self, string: &mut Vec<u8>, separator: &str)
Push the value to the string (the underlying
Vec<u8>
) with a
separator. Read moreSource§fn encode_to_bytes_buf(self, string: &mut BytesMut)
fn encode_to_bytes_buf(self, string: &mut BytesMut)
Push the value to the string (the underlying
bytes::BytesMut
).impl<T: Eq> Eq for StringWrapper<T>
impl<T> StructuralPartialEq for StringWrapper<T>
Auto Trait Implementations§
impl<T> Freeze for StringWrapper<T>where
T: Freeze,
impl<T> RefUnwindSafe for StringWrapper<T>where
T: RefUnwindSafe,
impl<T> Send for StringWrapper<T>where
T: Send,
impl<T> Sync for StringWrapper<T>where
T: Sync,
impl<T> Unpin for StringWrapper<T>where
T: Unpin,
impl<T> UnwindSafe for StringWrapper<T>where
T: UnwindSafe,
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