Struct refid::ByIdDeref [−][src]
Expand description
Similar to ById
, but uses identity as defined by the dereferenced inner value
This can, for example, be used to wrap references to Rc
s (or Arc
s) while the identity
depends on the referenced Rc
or Arc
).
Example:
use std::rc::Rc;
use refid::{ById, ByIdDeref};
let rc1 = Rc::new(());
let rc2 = Rc::new(());
let rc3 = rc1.clone();
assert_ne!(ByIdDeref(&rc1.clone()), ByIdDeref(&rc2.clone()));
assert_eq!(ByIdDeref(&rc1.clone()), ByIdDeref(&rc3.clone()));
// compare with:
assert_ne!(ById(&rc1.clone()), ById(&rc2.clone()));
assert_ne!(ById(&rc1.clone()), ById(&rc3.clone()));
Tuple Fields
0: T
inner value
(which can be dereferenced to a reference or another type that implements Id
)
Trait Implementations
Auto Trait Implementations
impl<T: ?Sized> RefUnwindSafe for ByIdDeref<T> where
T: RefUnwindSafe,
impl<T: ?Sized> UnwindSafe for ByIdDeref<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more