Enum go_vm::types::PointerObj
source · pub enum PointerObj {
UpVal(UpValue),
SliceMember(GosValue, OpIndex),
StructField(GosValue, OpIndex),
PkgMember(PackageKey, OpIndex),
}
Expand description
There are 4 types of pointers, they point to:
- local
- slice member
- struct field
- package member References to outer function’s local vars and pointers to local vars are all UpValues
Variants§
UpVal(UpValue)
SliceMember(GosValue, OpIndex)
StructField(GosValue, OpIndex)
PkgMember(PackageKey, OpIndex)
Implementations§
source§impl PointerObj
impl PointerObj
pub fn new_closed_up_value(val: &GosValue) -> PointerObj
pub fn new_slice_member( val: GosValue, i: OpIndex, t: ValueType, t_elem: ValueType ) -> RuntimeResult<PointerObj>
pub fn deref( &self, stack: &Stack, pkgs: &PackageObjs ) -> RuntimeResult<GosValue>
sourcepub fn cast(
&self,
new_type: ValueType,
stack: &Stack,
pkgs: &PackageObjs
) -> RuntimeResult<PointerObj>
pub fn cast( &self, new_type: ValueType, stack: &Stack, pkgs: &PackageObjs ) -> RuntimeResult<PointerObj>
cast returns the GosValue the pointer points to, with a new type obviously this is very unsafe, more rigorous checks should be done here.
sourcepub fn set_pointee(
&self,
val: &GosValue,
stack: &mut Stack,
pkgs: &PackageObjs,
gcc: &GcContainer
) -> RuntimeResult<()>
pub fn set_pointee( &self, val: &GosValue, stack: &mut Stack, pkgs: &PackageObjs, gcc: &GcContainer ) -> RuntimeResult<()>
set_value is not used by VM, it’s for FFI
Trait Implementations§
source§impl Clone for PointerObj
impl Clone for PointerObj
source§fn clone(&self) -> PointerObj
fn clone(&self) -> PointerObj
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for PointerObj
impl Debug for PointerObj
source§impl Display for PointerObj
impl Display for PointerObj
source§impl Hash for PointerObj
impl Hash for PointerObj
source§impl Ord for PointerObj
impl Ord for PointerObj
source§impl PartialEq<PointerObj> for PointerObj
impl PartialEq<PointerObj> for PointerObj
source§fn eq(&self, other: &PointerObj) -> bool
fn eq(&self, other: &PointerObj) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<PointerObj> for PointerObj
impl PartialOrd<PointerObj> for PointerObj
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more