Struct arithmetic_eval::OpaqueRef
source · pub struct OpaqueRef { /* private fields */ }
Expand description
Opaque reference to a native value.
The references cannot be created by interpreted code, but can be used as function args
or return values of native functions. References are Arc
’d, thus can easily be cloned.
References are comparable among each other:
- If the wrapped value implements
PartialEq
, this implementation will be used for comparison. - If
PartialEq
is not implemented, the comparison is by theArc
pointer.
Implementations§
source§impl OpaqueRef
impl OpaqueRef
sourcepub fn new<T>(value: T) -> Self
pub fn new<T>(value: T) -> Self
Creates a reference to value
that implements equality comparison.
Prefer using this method if the wrapped type implements PartialEq
.
sourcepub fn with_identity_eq<T: Any>(value: T) -> Self
pub fn with_identity_eq<T: Any>(value: T) -> Self
Creates a reference to value
with the identity comparison: values are considered
equal iff they point to the same data.
Prefer Self::new()
when possible.
sourcepub fn downcast_ref<T: Any>(&self) -> Option<&T>
pub fn downcast_ref<T: Any>(&self) -> Option<&T>
Tries to downcast this reference to a specific type.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OpaqueRef
impl !RefUnwindSafe for OpaqueRef
impl !Send for OpaqueRef
impl !Sync for OpaqueRef
impl Unpin for OpaqueRef
impl !UnwindSafe for OpaqueRef
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)