Trait std::ops::Deref 1.0.0
[−]
[src]
pub trait Deref { type Target: ?Sized; fn deref(&self) -> &Self::Target; }
The Deref
trait is used to specify the functionality of dereferencing
operations, like *v
.
Deref
also enables 'Deref
coercions'.
Examples
A struct with a single field which is accessible via dereferencing the struct.
use std::ops::Deref; struct DerefExample<T> { value: T } impl<T> Deref for DerefExample<T> { type Target = T; fn deref(&self) -> &T { &self.value } } fn main() { let x = DerefExample { value: 'a' }; assert_eq!('a', *x); }use std::ops::Deref; struct DerefExample<T> { value: T } impl<T> Deref for DerefExample<T> { type Target = T; fn deref(&self) -> &T { &self.value } } fn main() { let x = DerefExample { value: 'a' }; assert_eq!('a', *x); }
Associated Types
Required Methods
Implementors
impl<T> Deref for NonZero<T> where T: Zeroable
impl<T> Deref for Unique<T> where T: ?Sized
impl<T> Deref for Shared<T> where T: ?Sized
impl<'a, T> Deref for &'a T where T: ?Sized
impl<'a, T> Deref for &'a mut T where T: ?Sized
impl<'b, T> Deref for Ref<'b, T> where T: ?Sized
impl<'b, T> Deref for RefMut<'b, T> where T: ?Sized
impl<T> Deref for Box<T> where T: ?Sized
impl<T> Deref for Arc<T> where T: ?Sized
impl<T> Deref for Rc<T> where T: ?Sized
impl<'a, B> Deref for Cow<'a, B> where B: ToOwned + ?Sized
impl Deref for String
impl<T> Deref for Vec<T>
impl Deref for CString
impl Deref for OsString
impl<T> Deref for AssertUnwindSafe<T>
impl<T> Deref for AssertRecoverSafe<T>
impl Deref for PathBuf
impl<'mutex, T: ?Sized> Deref for MutexGuard<'mutex, T>
impl<'rwlock, T: ?Sized> Deref for RwLockReadGuard<'rwlock, T>
impl<'rwlock, T: ?Sized> Deref for RwLockWriteGuard<'rwlock, T>
impl<T: ?Sized> Deref for Box<T>
impl<T: ?Sized> Deref for Arc<T>
impl<T: ?Sized> Deref for Rc<T>
impl Deref for RcStr
impl Deref for InternedString
impl<T: ?Sized> Deref for P<T>
impl<'a, 'gcx, 'tcx> Deref for TyCtxt<'a, 'gcx, 'tcx>
impl<'a, B> Deref for Cow<'a, B> where B: ToOwned + ?Sized
impl Deref for String
impl<T> Deref for Vec<T>
impl<T> Deref for Box<T> where T: ?Sized
impl Deref for BuiltinBounds
impl<D> Deref for SnapshotVec<D> where D: SnapshotVecDelegate
impl<'a, 'gcx, 'tcx> Deref for PatCtxt<'a, 'gcx, 'tcx>
impl<'a, 'gcx, 'tcx> Deref for RegionCtxt<'a, 'gcx, 'tcx>
impl<'a, 'gcx, 'tcx> Deref for Inherited<'a, 'gcx, 'tcx>
impl<'a, 'gcx, 'tcx> Deref for FnCtxt<'a, 'gcx, 'tcx>
impl<'a, 'gcx, 'tcx> Deref for TyCtxt<'a, 'gcx, 'tcx>
impl<'a, B> Deref for Cow<'a, B> where B: ToOwned + ?Sized
impl Deref for String
impl<T> Deref for Vec<T>
impl<T> Deref for Box<T> where T: ?Sized
impl Deref for BuiltinBounds
impl<'a, 'gcx, 'tcx> Deref for TyCtxt<'a, 'gcx, 'tcx>
impl<'a, B> Deref for Cow<'a, B> where B: ToOwned + ?Sized
impl Deref for String
impl<T> Deref for Vec<T>
impl<T> Deref for Box<T> where T: ?Sized
impl Deref for BuiltinBounds
impl<D> Deref for SnapshotVec<D> where D: SnapshotVecDelegate
impl<'a, 'gcx, 'tcx> Deref for TyCtxt<'a, 'gcx, 'tcx>
impl<'a, B> Deref for Cow<'a, B> where B: ToOwned + ?Sized
impl Deref for String
impl<T> Deref for Vec<T>
impl<T> Deref for Box<T> where T: ?Sized
impl Deref for BuiltinBounds
impl<D> Deref for SnapshotVec<D> where D: SnapshotVecDelegate
impl<D: SnapshotVecDelegate> Deref for SnapshotVec<D>
impl<'a, 'gcx, 'tcx> Deref for TyCtxt<'a, 'gcx, 'tcx>
impl<'a, B> Deref for Cow<'a, B> where B: ToOwned + ?Sized
impl Deref for String
impl<T> Deref for Vec<T>
impl<T> Deref for Box<T> where T: ?Sized
impl Deref for BuiltinBounds
impl<'a, 'gcx, 'tcx> Deref for TyCtxt<'a, 'gcx, 'tcx>
impl<'a, B> Deref for Cow<'a, B> where B: ToOwned + ?Sized
impl Deref for String
impl<T> Deref for Vec<T>
impl<T> Deref for Box<T> where T: ?Sized
impl Deref for BuiltinBounds
impl<D> Deref for SnapshotVec<D> where D: SnapshotVecDelegate
impl Deref for RcStr
impl Deref for InternedString
impl<T> Deref for P<T> where T: ?Sized
impl Deref for Bytes
impl<'a, 'gcx, 'tcx> Deref for TyCtxt<'a, 'gcx, 'tcx>
impl<'a, B> Deref for Cow<'a, B> where B: ToOwned + ?Sized
impl Deref for String
impl<T> Deref for Vec<T>
impl<T> Deref for Box<T> where T: ?Sized
impl Deref for BuiltinBounds