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.
Sourcepub fn read_base(input: &mut InStream<'_>) -> Sys<Option<ValueHandle>>
pub fn read_base(input: &mut InStream<'_>) -> Sys<Option<ValueHandle>>
Reads a value where any valuetype (ValueBase, or null) may be,
as where an abstract interface is sent as a value: as the first of
the types it was sent with that is registered with
register_value, and MARSHAL if there is none.