Union pr47::data::Value [−][src]
#[repr(C)]
pub union Value {
pub ptr: *mut dyn DynBase,
pub ptr_repr: WidePointer,
pub vt_data: ValueTypedData,
}
Expand description
A generic stack value of Pr47. A stack value may be
- A value-typed data, see
pr47::data::value_typed::ValueTypedData
- A normal reference to “heap” object, see
pr47::data::wrapper::DynBase
- A custom pointer to container objects created in Pr47 VM, see
pr47::data::wrapper::custom_vt::ContainerVT
A normal reference may be either owned, or shared/mutably shared from Rust. Check
documentation of pr47::data::wrapper::Wrapper
for more information. A custom pointer should
never be shared from Rust, since it is only used when creating containers from Pr47 VM.
Pr47 uses tagged pointers to distinguish these three kinds of values:
+-----------------------------+
| WidePointer |
+--------------+--------------+
| ptr | vtable/len |
+-------|------+--------------+
|
|
+------------------------------+---+---+---+
| PTR-BITS ... 3 | 2 | 1 | 0 |
+------------------------------+---+---+---+
| 8 byte aligned pointer value | U | C | V |
+------------------------------+---+---+---+
U
: UnusedC
: ContainerV
: Value-typed
Since pr47::data::wrapper::Wrapper
is 8 byte aligned, it is safe to use such a tagged-pointer
Fields
ptr: *mut dyn DynBase
ptr_repr: WidePointer
vt_data: ValueTypedData
Implementations
Create a new “owned” Value
Create a new “shared” Value
Create a new “mutably shared” Value
Check if a Value
is a custom pointer
Assuming that self
may be a custom pointer, get the untagged pointer
Assuming that self
may be a custom pointer, get the reference counting
Given that self
MUST NOT be a custom pointer, get the reference counting
Assuming that self
may be a custom pointer, increase the reference counting
Given that self
MUST NOT be a custom pointer, increase the reference counting
Assuming that self
may be a custom pointer, decrease the reference counting
Given that self
MUST NOT be a custom pointer, decrease the reference counting
Given that self
MUST be a reference, assuming that self
may be a custom pointer, get
the ownership info
Given that self
MUST be a reference and MUST NOT be a custom pointer, get the
ownership info
Given that self
MUST be a reference, assuming that self
may be a custom pointer,
set the ownership info
Given that self
MUST be a reference and MUST NOT be a custom pointer, set the
ownership info
Given that self
MUST be a reference, assuming that self
may be a custom pointer,
get the GC information
Given that self
MUST be a reference and MUST NOT be a custom pointer, get the
GC information
Given that self
MUST be a reference, assuming that self
may be a custom pointer,
set the GC information
Given that self
MUST be a reference and MUST BOT be a custom pointer, set the GC
information
Given that self
MUST be a reference, assuming that self
may be a custom pointer,
get a pointer to the referenced data
Given that self
MUST be a reference and MUST NOT be a custom pointer, get a
pointer to the referenced data
Given that self
MUST be a reference to T
typed VM-owned data, assuming that self
may be a custom pointer, move the referenced data out
Given that self
MUST be a reference to T
typed VM-owned data, and MUST NOT be a
custom pointer, move out the referenced data out
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Value
impl !UnwindSafe for Value
Blanket Implementations
Mutably borrows from an owned value. Read more