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: Unused
  • C: Container
  • V: Value-typed

Since pr47::data::wrapper::Wrapper is 8 byte aligned, it is safe to use such a tagged-pointer

Fields

ptr: *mut dyn DynBaseptr_repr: WidePointervt_data: ValueTypedData

Implementations

Create a new “owned” Value

Create a new “shared” Value

Create a new “mutably shared” Value

Create a new integer Value

Create a new floating point number Value

Create a new character Value

Create a new boolean Value

Create a new null Value

Check if a Value is null.

Check if a Value is value-typed

Check if a Value is reference-typed

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.