[][src]Struct ketos::bytecode::Code

pub struct Code {
    pub name: Option<Name>,
    pub consts: Box<[Value]>,
    pub code: Box<[u8]>,
    pub kw_params: Box<[Name]>,
    pub n_params: u32,
    pub req_params: u32,
    pub flags: u32,
    pub doc: Option<String>,
}

Represents a compiled bytecode function or expression.

Fields

name: Option<Name>

Code object name, if present; top-level expressions and lambda code values do not have a name.

consts: Box<[Value]>

Const values referenced in bytecode

code: Box<[u8]>

Function body bytecode

kw_params: Box<[Name]>

Names of keyword parameters accepted in the order in which they are expected.

n_params: u32

Number of positional parameters accepted; this includes optional parameters, but excludes keyword and rest parameters, if accepted. Optional parameter values may be Unbound.

req_params: u32

Number of positional parameters which must not be Unbound.

flags: u32

Miscellaneous flags; see code_flags for bit flag values.

doc: Option<String>

Optional documentation string

Methods

impl Code[src]

pub fn arity(&self) -> Arity[src]

Returns the computed arity of the compiled function.

pub fn has_rest_params(&self) -> bool[src]

Returns whether the function accepts a rest parameter.

pub fn has_kw_params(&self) -> bool[src]

Returns whether the function accepts one or more keyword parameters.

pub fn is_trivial(&self) -> bool[src]

Returns whether all bytecode instructions can be executed without side effects.

Such a code object typically results from compilation of compile-time operators.

Trait Implementations

impl Clone for Code[src]

impl Debug for Code[src]

Auto Trait Implementations

impl !RefUnwindSafe for Code

impl !Send for Code

impl !Sync for Code

impl Unpin for Code

impl !UnwindSafe for Code

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,