pub struct ValueRef(/* private fields */);Expand description
An instance of a valuetype or a value box: its type and its state.
Clones share the instance, as references do in the language
mappings: an instance written twice in a message is sent once, then as
an indirection to it, and is read back as one instance. Instances may
refer to each other in cycles; Value::break_cycles frees them.
Implementations§
Source§impl ValueRef
impl ValueRef
Sourcepub fn new(tc: TypeCode, members: Vec<Value>) -> ValueRef
pub fn new(tc: TypeCode, members: Vec<Value>) -> ValueRef
An instance of the valuetype tc (the most derived type) with the
values of its state members: those of its base types first, then
its own, in the order of the TypeCodes. An instance of a value box
has the boxed value as its one member.
Sourcepub fn native(&self) -> Option<Native>
pub fn native(&self) -> Option<Native>
The object of a language binding set with ValueRef::set_native.
Sourcepub fn set_native(&self, native: Option<Native>)
pub fn set_native(&self, native: Option<Native>)
Sets (or, with None, removes) the object of a language binding
that stands for this instance: a custom reader
(register_custom_reader) sets the instance it made, so that
the binding finds it again when it converts the value.
Sourcepub fn set_members(&self, members: Vec<Value>)
pub fn set_members(&self, members: Vec<Value>)
Replaces the values of the state members.
Sourcepub fn take_members(&self) -> Vec<Value>
pub fn take_members(&self) -> Vec<Value>
Takes the values of the state members, leaving none.