Trait nom::lib::std::ops::Deref1.0.0[][src]

pub trait Deref {
    type Target: ?Sized;
    #[must_use]
    pub fn deref(&self) -> &Self::Target;
}
[]

Used for immutable dereferencing operations, like *v.

In addition to being used for explicit dereferencing operations with the (unary) * operator in immutable contexts, Deref is also used implicitly by the compiler in many circumstances. This mechanism is called Deref coercion’. In mutable contexts, DerefMut is used.

Implementing Deref for smart pointers makes accessing the data behind them convenient, which is why they implement Deref. On the other hand, the rules regarding Deref and DerefMut were designed specifically to accommodate smart pointers. Because of this, Deref should only be implemented for smart pointers to avoid confusion.

For similar reasons, this trait should never fail. Failure during dereferencing can be extremely confusing when Deref is invoked implicitly.

More on Deref coercion

If T implements Deref<Target = U>, and x is a value of type T, then:

For more details, visit the chapter in The Rust Programming Language as well as the reference sections on the dereference operator, method resolution and type coercions.

Examples

A struct with a single field which is accessible by dereferencing the struct.

use std::ops::Deref;

struct DerefExample<T> {
    value: T
}

impl<T> Deref for DerefExample<T> {
    type Target = T;

    fn deref(&self) -> &Self::Target {
        &self.value
    }
}

let x = DerefExample { value: 'a' };
assert_eq!('a', *x);

Associated Types

type Target: ?Sized[src][]

The resulting type after dereferencing.

Required methods

#[must_use]
pub fn deref(&self) -> &Self::Target
[src][]

Dereferences the value.

Implementations on Foreign Types

impl<'a> Deref for IoSliceMut<'a>[src]

type Target = [u8]

impl<'_, T> Deref for RwLockReadGuard<'_, T> where
    T: ?Sized
[src]

type Target = T

impl Deref for PathBuf[src]

impl<'a> Deref for IoSlice<'a>[src]

type Target = [u8]

impl<'_, T> Deref for MutexGuard<'_, T> where
    T: ?Sized
[src]

type Target = T

impl Deref for OsString[src]

impl Deref for CString[src]

impl<'_, T> Deref for RwLockWriteGuard<'_, T> where
    T: ?Sized
[src]

type Target = T

impl<T, F> Deref for SyncLazy<T, F> where
    F: FnOnce() -> T, 
[src]

type Target = T

impl<T> Deref for AssertUnwindSafe<T>[src]

type Target = T

impl<P> Deref for Pin<P> where
    P: Deref
[src]

impl<'a, 'f> Deref for VaList<'a, 'f> where
    'f: 'a, 
[src]

impl<'_, T> Deref for &'_ mut T where
    T: ?Sized
[src]

type Target = T

impl<'_, T> Deref for &'_ T where
    T: ?Sized
[src]

type Target = T

impl<T, F> Deref for Lazy<T, F> where
    F: FnOnce() -> T, 
[src]

type Target = T

impl<'_, T> Deref for RefMut<'_, T> where
    T: ?Sized
[src]

type Target = T

impl<'_, T> Deref for Ref<'_, T> where
    T: ?Sized
[src]

type Target = T

impl<T> Deref for Arc<T> where
    T: ?Sized
[src]

type Target = T

impl<T> Deref for Rc<T> where
    T: ?Sized
[src]

type Target = T

Implementors

impl Deref for String[src]

impl<'_, B> Deref for Cow<'_, B> where
    B: ToOwned + ?Sized
[src]

type Target = B

impl<'_, T> Deref for PeekMut<'_, T> where
    T: Ord
1.12.0[src]

type Target = T

impl<T> Deref for ManuallyDrop<T> where
    T: ?Sized
1.20.0[src]

type Target = T

impl<T, A> Deref for Box<T, A> where
    T: ?Sized,
    A: Allocator
[src]

type Target = T

impl<T, A> Deref for Vec<T, A> where
    A: Allocator
[src]

type Target = [T]

impl<T: ?Sized + Pointable> Deref for Owned<T>

impl<T> Deref for CachePadded<T>

impl<T: ?Sized> Deref for ShardedLockReadGuard<'_, T>

impl<T: ?Sized> Deref for ShardedLockWriteGuard<'_, T>

impl Deref for PathList

impl<T> Deref for SpannedValue<T>

impl Deref for Flag

impl<L, R> Deref for Either<L, R> where
    L: Deref,
    R: Deref<Target = L::Target>, 

impl<S: Stream + Unpin> Deref for BlockingStream<S>

impl Deref for WakerRef<'_>

impl<T: ?Sized> Deref for MutexGuard<'_, T>

impl<T: ?Sized, U: ?Sized> Deref for MappedMutexGuard<'_, T, U>

impl<T, N> Deref for GenericArray<T, N> where
    N: ArrayLength<T>, 

impl<'input, Endian> Deref for EndianSlice<'input, Endian> where
    Endian: Endianity

impl<'a> Deref for State<'a>

impl Deref for TranslationUnit

impl<'a> Deref for Blob<'a>

impl<P, Container> Deref for ImageBuffer<P, Container> where
    P: Pixel + 'static,
    P::Subpixel: 'static,
    Container: Deref<Target = [P::Subpixel]>, 

impl<'a, R: RawMutex + 'a, T: ?Sized + 'a> Deref for MutexGuard<'a, R, T>

impl<'a, R: RawMutex + 'a, T: ?Sized + 'a> Deref for MappedMutexGuard<'a, R, T>

impl<'a, R: RawMutex + 'a, G: GetThreadId + 'a, T: ?Sized + 'a> Deref for ReentrantMutexGuard<'a, R, G, T>

impl<'a, R: RawMutex + 'a, G: GetThreadId + 'a, T: ?Sized + 'a> Deref for MappedReentrantMutexGuard<'a, R, G, T>

impl<'a, R: RawRwLock + 'a, T: ?Sized + 'a> Deref for RwLockReadGuard<'a, R, T>

impl<'a, R: RawRwLock + 'a, T: ?Sized + 'a> Deref for RwLockWriteGuard<'a, R, T>

impl<'a, R: RawRwLockUpgrade + 'a, T: ?Sized + 'a> Deref for RwLockUpgradableReadGuard<'a, R, T>

impl<'a, R: RawRwLock + 'a, T: ?Sized + 'a> Deref for MappedRwLockReadGuard<'a, R, T>

impl<'a, R: RawRwLock + 'a, T: ?Sized + 'a> Deref for MappedRwLockWriteGuard<'a, R, T>

impl<N: Scalar, S> Deref for Matrix<N, U1, U1, S> where
    S: ContiguousStorage<N, U1, U1>, 

impl<N: Scalar, S> Deref for Matrix<N, U2, U1, S> where
    S: ContiguousStorage<N, U2, U1>, 

impl<N: Scalar, S> Deref for Matrix<N, U3, U1, S> where
    S: ContiguousStorage<N, U3, U1>, 

impl<N: Scalar, S> Deref for Matrix<N, U4, U1, S> where
    S: ContiguousStorage<N, U4, U1>, 

impl<N: Scalar, S> Deref for Matrix<N, U5, U1, S> where
    S: ContiguousStorage<N, U5, U1>, 

impl<N: Scalar, S> Deref for Matrix<N, U6, U1, S> where
    S: ContiguousStorage<N, U6, U1>, 

impl<N: Scalar, S> Deref for Matrix<N, U1, U2, S> where
    S: ContiguousStorage<N, U1, U2>, 

impl<N: Scalar, S> Deref for Matrix<N, U1, U3, S> where
    S: ContiguousStorage<N, U1, U3>, 

impl<N: Scalar, S> Deref for Matrix<N, U1, U4, S> where
    S: ContiguousStorage<N, U1, U4>, 

impl<N: Scalar, S> Deref for Matrix<N, U1, U5, S> where
    S: ContiguousStorage<N, U1, U5>, 

impl<N: Scalar, S> Deref for Matrix<N, U1, U6, S> where
    S: ContiguousStorage<N, U1, U6>, 

impl<N: Scalar, S> Deref for Matrix<N, U2, U2, S> where
    S: ContiguousStorage<N, U2, U2>, 

impl<N: Scalar, S> Deref for Matrix<N, U2, U3, S> where
    S: ContiguousStorage<N, U2, U3>, 

impl<N: Scalar, S> Deref for Matrix<N, U2, U4, S> where
    S: ContiguousStorage<N, U2, U4>, 

impl<N: Scalar, S> Deref for Matrix<N, U2, U5, S> where
    S: ContiguousStorage<N, U2, U5>, 

impl<N: Scalar, S> Deref for Matrix<N, U2, U6, S> where
    S: ContiguousStorage<N, U2, U6>, 

impl<N: Scalar, S> Deref for Matrix<N, U3, U2, S> where
    S: ContiguousStorage<N, U3, U2>, 

impl<N: Scalar, S> Deref for Matrix<N, U3, U3, S> where
    S: ContiguousStorage<N, U3, U3>, 

impl<N: Scalar, S> Deref for Matrix<N, U3, U4, S> where
    S: ContiguousStorage<N, U3, U4>, 

impl<N: Scalar, S> Deref for Matrix<N, U3, U5, S> where
    S: ContiguousStorage<N, U3, U5>, 

impl<N: Scalar, S> Deref for Matrix<N, U3, U6, S> where
    S: ContiguousStorage<N, U3, U6>, 

impl<N: Scalar, S> Deref for Matrix<N, U4, U2, S> where
    S: ContiguousStorage<N, U4, U2>, 

impl<N: Scalar, S> Deref for Matrix<N, U4, U3, S> where
    S: ContiguousStorage<N, U4, U3>, 

impl<N: Scalar, S> Deref for Matrix<N, U4, U4, S> where
    S: ContiguousStorage<N, U4, U4>, 

impl<N: Scalar, S> Deref for Matrix<N, U4, U5, S> where
    S: ContiguousStorage<N, U4, U5>, 

impl<N: Scalar, S> Deref for Matrix<N, U4, U6, S> where
    S: ContiguousStorage<N, U4, U6>, 

impl<N: Scalar, S> Deref for Matrix<N, U5, U2, S> where
    S: ContiguousStorage<N, U5, U2>, 

impl<N: Scalar, S> Deref for Matrix<N, U5, U3, S> where
    S: ContiguousStorage<N, U5, U3>, 

impl<N: Scalar, S> Deref for Matrix<N, U5, U4, S> where
    S: ContiguousStorage<N, U5, U4>, 

impl<N: Scalar, S> Deref for Matrix<N, U5, U5, S> where
    S: ContiguousStorage<N, U5, U5>, 

impl<N: Scalar, S> Deref for Matrix<N, U5, U6, S> where
    S: ContiguousStorage<N, U5, U6>, 

impl<N: Scalar, S> Deref for Matrix<N, U6, U2, S> where
    S: ContiguousStorage<N, U6, U2>, 

impl<N: Scalar, S> Deref for Matrix<N, U6, U3, S> where
    S: ContiguousStorage<N, U6, U3>, 

impl<N: Scalar, S> Deref for Matrix<N, U6, U4, S> where
    S: ContiguousStorage<N, U6, U4>, 

impl<N: Scalar, S> Deref for Matrix<N, U6, U5, S> where
    S: ContiguousStorage<N, U6, U5>, 

impl<N: Scalar, S> Deref for Matrix<N, U6, U6, S> where
    S: ContiguousStorage<N, U6, U6>, 

impl<N, R, C> Deref for ArrayStorage<N, R, C> where
    R: DimName,
    C: DimName,
    R::Value: Mul<C::Value>,
    Prod<R::Value, C::Value>: ArrayLength<N>, 

impl<T> Deref for Unit<T>

impl<N: Scalar> Deref for Point<N, U1> where
    DefaultAllocator: Allocator<N, U1>, 

impl<N: Scalar> Deref for Point<N, U2> where
    DefaultAllocator: Allocator<N, U2>, 

impl<N: Scalar> Deref for Point<N, U3> where
    DefaultAllocator: Allocator<N, U3>, 

impl<N: Scalar> Deref for Point<N, U4> where
    DefaultAllocator: Allocator<N, U4>, 

impl<N: Scalar> Deref for Point<N, U5> where
    DefaultAllocator: Allocator<N, U5>, 

impl<N: Scalar> Deref for Point<N, U6> where
    DefaultAllocator: Allocator<N, U6>, 

impl<N: Scalar + SimdValue> Deref for Quaternion<N>

impl<N: Scalar> Deref for Translation<N, U1> where
    DefaultAllocator: Allocator<N, U1>, 

impl<N: Scalar> Deref for Translation<N, U2> where
    DefaultAllocator: Allocator<N, U2>, 

impl<N: Scalar> Deref for Translation<N, U3> where
    DefaultAllocator: Allocator<N, U3>, 

impl<N: Scalar> Deref for Translation<N, U4> where
    DefaultAllocator: Allocator<N, U4>, 

impl<N: Scalar> Deref for Translation<N, U5> where
    DefaultAllocator: Allocator<N, U5>, 

impl<N: Scalar> Deref for Translation<N, U6> where
    DefaultAllocator: Allocator<N, U6>, 

impl<N: RealField> Deref for ShapeHandle<N>

impl<T: PartialOrd> Deref for SortedPair<T>

impl<T, F: FnOnce() -> T> Deref for Lazy<T, F>

impl<T, F: FnOnce() -> T> Deref for Lazy<T, F>

impl<C> Deref for Matrix<C>

impl<'a, G> Deref for Frozen<'a, G>

impl<'b, T> Deref for Ptr<'b, T>

impl Deref for Literal

impl Deref for Selectable

impl Deref for SkeletonRef

impl Deref for SkeletonName

impl Deref for BoneBase

impl Deref for BoneName

impl Deref for RootMotionBone

impl Deref for BoneWeightsAndIndicesBuffer

impl Deref for ArmatureMatricesBuffer

impl Deref for ArmatureDualQuatsBuffer

impl<T> Deref for Parameter<T>

impl Deref for MaterialMultiRef

impl Deref for Name

impl Deref for SourcePath

impl Deref for LightAsCameraUBO

impl Deref for ProgramRef

impl Deref for StaticMap

impl Deref for GpuGeometryRef

impl Deref for GpuDebugGeometryRef

impl Deref for GeomToGpuGeomRef

impl Deref for VertexBuffer

impl Deref for IndicesBuffer

impl Deref for DebugNormals

impl Deref for ShadowGeometry

impl Deref for CameraUBO

impl Deref for LightingUBO

impl Deref for LightData

impl Deref for ModelMatricesData

impl Deref for AllModelMatricesData

impl Deref for StaticModelMatricesData

impl Deref for DynamicModelMatricesData

impl Deref for ModelMatricesBuffer

impl Deref for StaticModelMatricesBuffer

impl Deref for DynamicModelMatricesBuffer

impl Deref for AllModelMatricesBuffer

impl Deref for OpaqueSortedGeometry

impl Deref for TranslucentSortedGeometry

impl Deref for DebugSortedGeometry

impl Deref for DynamicShadowsSortedGeometry

impl Deref for StaticShadowsSortedGeometry

impl Deref for AllShadowsSortedGeometry

impl Deref for GeometryWithModelsIndex

impl Deref for SkinningUpToDate

impl Deref for PreviousTransformation

impl Deref for Viewport

impl<C> Deref for Camera<C>

impl<T: 'static + Clone> Deref for Geometry<T>

impl Deref for GeometryRef

impl Deref for Submesh

impl Deref for Shape

impl Deref for Offset

impl Deref for CollisionHandle

impl Deref for DebugGeometry

impl Deref for Map

impl Deref for StaticMap

impl Deref for Speed

impl Deref for Velocity

impl Deref for Delta

impl<T> Deref for LazyUpdate<T>

impl<T> Deref for Lazy<T>

impl<T> Deref for ValueCache<T>

impl Deref for WORKSPACE_DIR

impl Deref for Data

impl<T> Deref for Node<T>

impl<'a, T: 'a> Deref for NodeIdMut<'a, T>

impl<'a, T: 'a> Deref for NodeIdRef<'a, T>

impl Deref for UniqueEntity

impl<'a, T> Deref for RefMut<'a, T>

impl<'a, T> Deref for SliceView<'a, T>

impl<'a, T> Deref for SliceViewMut<'a, T>

impl<'a, T> Deref for Res<'a, T>

impl<'a, T> Deref for ResMut<'a, T>

impl<'a, T: Component> Deref for Read<'a, T> where
    T::Storage: Storage<'s, T>,
    <<T as Component>::Storage as Storage<'a, T>>::Get: Borrow<<<T as Component>::Storage as Storage<'a, T>>::DerefTarget>, 

impl<'a, T: Component> Deref for Write<'a, T> where
    <<T as Component>::Storage as Storage<'a, T>>::GetMut: Borrow<<<T as Component>::Storage as Storage<'a, T>>::DerefTarget>,
    <T as Component>::Storage: Storage<'s, T>, 

impl<'a, T: Component, Not: 'static> Deref for ReadNot<'a, T, Not> where
    <<T as Component>::Storage as Storage<'a, T>>::Get: Borrow<<<T as Component>::Storage as Storage<'a, T>>::DerefTarget>,
    <T as Component>::Storage: Storage<'s, T>, 

impl<T: 'static> Deref for HasOption<T>

impl<'a, T: Component> Deref for ReadOption<'a, T> where
    <T as Component>::Storage: Storage<'s, T>, 

impl<'a, T: Component> Deref for WriteOption<'a, T>

impl<'a, T: TupleAny<'a>> Deref for ReadOr<'a, T>

impl<'a, T: NToOneComponent<'a>, R: UnorderedData<'a>> Deref for Ref<'a, T, R>

impl<'a, T: OneToOneComponent<'a>, R: UnorderedData<'a>> Deref for URef<'a, T, R>

impl<'a, T, R> Deref for RefN<'a, T, R> where
    R: UnorderedData<'a>, 

impl<T, F, S> Deref for ScopeGuard<T, F, S> where
    F: FnOnce(T),
    S: Strategy

impl<A: Array> Deref for SmallVec<A>

impl Deref for Data

impl Deref for Underscore

impl Deref for Add

impl Deref for And

impl Deref for At

impl Deref for Bang

impl Deref for Caret

impl Deref for Colon

impl Deref for Comma

impl Deref for Div

impl Deref for Dollar

impl Deref for Dot

impl Deref for Eq

impl Deref for Gt

impl Deref for Lt

impl Deref for Or

impl Deref for Pound

impl Deref for Question

impl Deref for Rem

impl Deref for Semi

impl Deref for Star

impl Deref for Sub

impl Deref for Tilde

impl<'c, 'a> Deref for StepCursor<'c, 'a>