pub struct ValueHandle(/* private fields */);Expand description
A shared reference to a valuetype instance.
Implementations§
Source§impl ValueHandle
impl ValueHandle
Sourcepub fn new<S: ValueState>(state: S) -> ValueHandle
pub fn new<S: ValueState>(state: S) -> ValueHandle
A new instance with the state state.
Sourcepub fn is_a(&self, id: &str) -> bool
pub fn is_a(&self, id: &str) -> bool
Whether the instance is of the valuetype id or of a type derived
from it.
Sourcepub fn ptr_eq(&self, other: &ValueHandle) -> bool
pub fn ptr_eq(&self, other: &ValueHandle) -> bool
Whether both are the same instance.
Sourcepub fn with<S: 'static, R>(&self, f: impl FnOnce(&S) -> R) -> R
pub fn with<S: 'static, R>(&self, f: impl FnOnce(&S) -> R) -> R
Runs f on the state S of the instance (its own, or that of a
base type). Panics if the instance has no state S, which the
generated handles rule out. Touching the same instance in f
deadlocks.
Sourcepub fn with_mut<S: 'static, R>(&self, f: impl FnOnce(&mut S) -> R) -> R
pub fn with_mut<S: 'static, R>(&self, f: impl FnOnce(&mut S) -> R) -> R
Runs f on the state S of the instance, to change it.
Sourcepub fn read(
input: &mut InStream<'_>,
expected: &'static ValueInfo,
) -> Sys<Option<ValueHandle>>
pub fn read( input: &mut InStream<'_>, expected: &'static ValueInfo, ) -> Sys<Option<ValueHandle>>
Reads a value where one of the valuetype expected (or null) is.
A value is read as the first of the types it was sent with that is
expected or a type registered with register_value derived
from it, and is MARSHAL if there is none.
Trait Implementations§
Source§impl Clone for ValueHandle
impl Clone for ValueHandle
Auto Trait Implementations§
impl Freeze for ValueHandle
impl RefUnwindSafe for ValueHandle
impl Send for ValueHandle
impl Sync for ValueHandle
impl Unpin for ValueHandle
impl UnsafeUnpin for ValueHandle
impl UnwindSafe for ValueHandle
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