#[repr(transparent)]
pub struct ByThinAddress<T>(pub T) where T: ?Sized + Deref;
Expand description

Similar to ByAddress, but omits the attributes of fat pointers.

This means that two slices with the same starting element but different lengths will be considered equal.

Two trait objects with the same data pointer but different vtables will also be considered equal. (In particular, this may happen for traits that are implemented on zero-sized types, including Fn and other closure traits.)

Tuple Fields§

§0: T

Implementations§

source§

impl<T> ByThinAddress<T>
where T: ?Sized + Deref,

source

pub fn from_ref(r: &T) -> &Self

Convert &T to &ByThinAddress<T>.

Trait Implementations§

source§

impl<T, U> AsRef<U> for ByThinAddress<T>
where T: ?Sized + Deref + AsRef<U>,

source§

fn as_ref(&self) -> &U

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

impl<T> Clone for ByThinAddress<T>
where T: ?Sized + Deref + Clone,

source§

fn clone(&self) -> ByThinAddress<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Debug for ByThinAddress<T>
where T: ?Sized + Deref + Debug,

source§

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

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

impl<T> Default for ByThinAddress<T>
where T: ?Sized + Deref + Default,

source§

fn default() -> ByThinAddress<T>

Returns the “default value” for a type. Read more
source§

impl<T> Deref for ByThinAddress<T>
where T: ?Sized + Deref,

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T> DerefMut for ByThinAddress<T>
where T: ?Sized + Deref,

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

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

source§

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

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

impl<T> Hash for ByThinAddress<T>
where T: ?Sized + Deref,

Raw pointer hashing

source§

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

Feeds this value into the given Hasher. Read more
source§

impl<T> Ord for ByThinAddress<T>
where T: ?Sized + Deref,

Raw pointer ordering

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
source§

impl<T> PartialEq for ByThinAddress<T>
where T: ?Sized + Deref,

Raw pointer equality

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> PartialOrd for ByThinAddress<T>
where T: ?Sized + Deref,

Raw pointer comparison

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T> Copy for ByThinAddress<T>
where T: ?Sized + Deref + Copy,

source§

impl<T> Eq for ByThinAddress<T>
where T: ?Sized + Deref,

Auto Trait Implementations§

§

impl<T: ?Sized> Freeze for ByThinAddress<T>
where T: Freeze,

§

impl<T: ?Sized> RefUnwindSafe for ByThinAddress<T>
where T: RefUnwindSafe,

§

impl<T: ?Sized> Send for ByThinAddress<T>
where T: Send,

§

impl<T: ?Sized> Sync for ByThinAddress<T>
where T: Sync,

§

impl<T: ?Sized> Unpin for ByThinAddress<T>
where T: Unpin,

§

impl<T: ?Sized> UnwindSafe for ByThinAddress<T>
where T: 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.