Struct NewtypeRef

Source
pub struct NewtypeRef<Marker, T>
where T: Deref,
{ /* private fields */ }
Expand description

A slice for a NewtypeBuf

Implementations§

Source§

impl<Marker> NewtypeRef<Marker, String>

Source

pub fn len(&self) -> usize

Returns the length of this buffer.

Source

pub fn is_empty(&self) -> bool

Returns true if this buffer is empty.

Trait Implementations§

Source§

impl<Marker, T, R> AsRef<R> for NewtypeRef<Marker, T>
where T: Deref, T::Target: AsRef<R>, R: ?Sized,

Source§

fn as_ref(&self) -> &R

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<Marker, T> Borrow<NewtypeRef<Marker, T>> for NewtypeBuf<Marker, T>
where T: Deref,

Source§

fn borrow(&self) -> &NewtypeRef<Marker, T>

Immutably borrows from an owned value. Read more
Source§

impl<Marker, T> Debug for NewtypeRef<Marker, T>
where T: Deref, T::Target: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Marker, T> Display for NewtypeRef<Marker, T>
where T: Deref, T::Target: Display,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, Marker, T> From<&'a NewtypeRef<Marker, T>> for &'a str
where T: Deref<Target = str>,

Source§

fn from(s: &'a NewtypeRef<Marker, T>) -> Self

Converts to this type from the input type.
Source§

impl<'a, Marker, T> From<&'a str> for &'a NewtypeRef<Marker, T>
where T: Deref<Target = str>,

Source§

fn from(s: &'a str) -> Self

Converts to this type from the input type.
Source§

impl<Marker, T> Hash for NewtypeRef<Marker, T>
where T: Deref, T::Target: Hash,

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<Marker, T> PartialEq for NewtypeRef<Marker, T>
where T: Deref, T::Target: PartialEq,

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Marker, T, R> ToOwned for NewtypeRef<Marker, T>
where T: Deref, T::Target: ToOwned<Owned = R>, R: Into<T>,

Source§

type Owned = NewtypeBuf<Marker, T>

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> Self::Owned

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<Marker, T> TransparentWrapper<<T as Deref>::Target> for NewtypeRef<Marker, T>
where T: Deref,

Source§

fn wrap(s: Inner) -> Self
where Self: Sized,

Convert the inner type into the wrapper type.
Source§

fn wrap_ref(s: &Inner) -> &Self

Convert a reference to the inner type into a reference to the wrapper type.
Source§

fn wrap_mut(s: &mut Inner) -> &mut Self

Convert a mutable reference to the inner type into a mutable reference to the wrapper type.
Source§

fn wrap_slice(s: &[Inner]) -> &[Self]
where Self: Sized,

Convert a slice to the inner type into a slice to the wrapper type.
Source§

fn wrap_slice_mut(s: &mut [Inner]) -> &mut [Self]
where Self: Sized,

Convert a mutable slice to the inner type into a mutable slice to the wrapper type.
Source§

fn peel(s: Self) -> Inner
where Self: Sized,

Convert the wrapper type into the inner type.
Source§

fn peel_ref(s: &Self) -> &Inner

Convert a reference to the wrapper type into a reference to the inner type.
Source§

fn peel_mut(s: &mut Self) -> &mut Inner

Convert a mutable reference to the wrapper type into a mutable reference to the inner type.
Source§

fn peel_slice(s: &[Self]) -> &[Inner]
where Self: Sized,

Convert a slice to the wrapped type into a slice to the inner type.
Source§

fn peel_slice_mut(s: &mut [Self]) -> &mut [Inner]
where Self: Sized,

Convert a mutable slice to the wrapped type into a mutable slice to the inner type.
Source§

impl<Marker, T> Eq for NewtypeRef<Marker, T>
where T: Deref, T::Target: Eq,

Auto Trait Implementations§

§

impl<Marker, T> Freeze for NewtypeRef<Marker, T>
where <T as Deref>::Target: Freeze,

§

impl<Marker, T> RefUnwindSafe for NewtypeRef<Marker, T>
where <T as Deref>::Target: RefUnwindSafe, Marker: RefUnwindSafe,

§

impl<Marker, T> Send for NewtypeRef<Marker, T>
where <T as Deref>::Target: Send, Marker: Send,

§

impl<Marker, T> Sync for NewtypeRef<Marker, T>
where <T as Deref>::Target: Sync, Marker: Sync,

§

impl<Marker, T> Unpin for NewtypeRef<Marker, T>
where <T as Deref>::Target: Unpin, Marker: Unpin,

§

impl<Marker, T> UnwindSafe for NewtypeRef<Marker, T>
where <T as Deref>::Target: UnwindSafe, Marker: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.