pub struct Import {
pub module: StrId,
pub name: StrId,
pub sig: TypeId,
pub params: Option<ParamList>,
}Expand description
A host function the module calls by index
(Inst::CallImport), bound by the loader by
module and name.
An import is also a first-class value: Inst::LoadImport
makes a function value of it that every dynamic call form accepts. With a
ParamList, dynamic calls of it take named, spread, extra, and missing
arguments as for a bytecode function (specs/LSB.md §5.15); the host
receives the bound parameters in signature order, presence mask included.
§Examples
use bytecode_lang::{Import, StrId, TypeId};
let print = Import { module: StrId(0), name: StrId(1), sig: TypeId(2), params: None };
assert_eq!(print.sig, TypeId(2));Fields§
§module: StrIdThe providing module’s name (for example ls.io).
name: StrIdThe function’s name within that module.
sig: TypeIdThe function’s signature (a TypeDef::Func entry).
params: Option<ParamList>The dynamic-call signature, if the host function takes named,
variadic, optional, or by-reference arguments; None means exact
positional arity.
Trait Implementations§
impl Eq for Import
Source§impl Ord for Import
impl Ord for Import
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Import
impl PartialOrd for Import
impl StructuralPartialEq for Import
Auto Trait Implementations§
impl Freeze for Import
impl RefUnwindSafe for Import
impl Send for Import
impl Sync for Import
impl Unpin for Import
impl UnsafeUnpin for Import
impl UnwindSafe for Import
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more