Struct FfiCtx

Source
pub struct FfiCtx<'a> {
    pub func_name: &'a str,
    pub vm_objs: &'a VMObjects,
    pub user_data: Option<usize>,
    pub stack: &'a mut Stack,
    pub gcc: &'a GcContainer,
    /* private fields */
}

Fields§

§func_name: &'a str§vm_objs: &'a VMObjects§user_data: Option<usize>§stack: &'a mut Stack§gcc: &'a GcContainer

Implementations§

Source§

impl<'a> FfiCtx<'a>

Source

pub fn new_nil(t: ValueType) -> GosValue

Source

pub fn new_nil_slice(t_elem: ValueType) -> GosValue

Source

pub fn new_uint_ptr(u: usize) -> GosValue

Source

pub fn new_complex64(r: f32, i: f32) -> GosValue

Source

pub fn new_function(f: FunctionKey) -> GosValue

Source

pub fn new_package(p: PackageKey) -> GosValue

Source

pub fn new_metadata(m: Meta) -> GosValue

Source

pub fn new_complex128(r: f64, i: f64) -> GosValue

Source

pub fn new_string(s: &str) -> GosValue

Source

pub fn new_unsafe_ptr(p: Rc<dyn UnsafePtr>) -> GosValue

Source

pub fn new_struct(&self, fields: Vec<GosValue>) -> GosValue

Source

pub fn new_array(&self, member: Vec<GosValue>, t_elem: ValueType) -> GosValue

Source

pub fn new_primitive_array<T>( &self, member: Vec<T>, t_elem: ValueType, ) -> GosValue
where T: CellData,

Source

pub fn new_map(&self, m: HashMap<GosValue, GosValue>) -> GosValue

Source

pub fn new_pointer(pointee: GosValue) -> GosValue

Source

pub fn new_interface( &self, underlying: GosValue, metas: Option<(&Meta, Meta)>, ) -> GosValue

Create a new interface value with the underlying value, and optionally the meta of the interface and the value.

– Note – if you pass None to metas, the returned interface won’t behave like a normal interface. you cannot cast it or call it’s methods.

§Arguments
  • underlying - The underlying value
  • metas - (Interface meta, value meta)
Source

pub fn new_empty_interface(&self, underlying: GosValue, meta: Meta) -> GosValue

Source

pub fn deref_pointer(&self, ptr: &GosValue) -> Result<GosValue, RuntimeError>

Source

pub fn zero_val(&self, m: &Meta) -> GosValue

Source

pub fn slice_as_rust_slice<T>( val: &GosValue, ) -> Result<Ref<'_, [T]>, RuntimeError>
where T: Element,

Source

pub fn slice_as_primitive_slice<'b, C, D>( val: &'b GosValue, ) -> Result<Ref<'b, [D]>, RuntimeError>
where C: CellData + 'b, D: Copy,

Source

pub fn array_as_rust_slice<T>(val: &GosValue) -> Ref<'_, [T]>
where T: Element,

Source

pub fn array_as_primitive_slice<'b, C, D>(val: &'b GosValue) -> Ref<'b, [D]>
where C: CellData + 'b, D: Copy,

Auto Trait Implementations§

§

impl<'a> Freeze for FfiCtx<'a>

§

impl<'a> !RefUnwindSafe for FfiCtx<'a>

§

impl<'a> !Send for FfiCtx<'a>

§

impl<'a> !Sync for FfiCtx<'a>

§

impl<'a> Unpin for FfiCtx<'a>

§

impl<'a> !UnwindSafe for FfiCtx<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.