Struct OnionLambdaDefinition

Source
pub struct OnionLambdaDefinition { /* private fields */ }
Expand description

Onion 虚拟机 Lambda 定义。

封装参数、捕获、Lambda 体、签名、类型等。

Implementations§

Source§

impl OnionLambdaDefinition

Source

pub fn new_static( parameter: LambdaParameter, body: LambdaBody, capture: OnionFastMap<Box<str>, OnionObject>, signature: Box<str>, lambda_type: LambdaType, ) -> OnionStaticObject

Source

pub fn new_static_with_self( parameter: LambdaParameter, body: LambdaBody, capture: OnionFastMap<Box<str>, OnionObject>, self_object: &OnionObject, signature: Box<str>, lambda_type: LambdaType, ) -> OnionStaticObject

Source

pub fn create_key_pool(&self) -> OnionKeyPool<Box<str>>

Source

pub fn with_lambda_type(&self, lambda_type: LambdaType) -> Self

Source

pub fn lambda_type(&self) -> &LambdaType

Source

pub fn create_runnable( &self, argument: &OnionFastMap<Box<str>, OnionStaticObject>, this_lambda: &OnionStaticObject, self_object: &OnionObject, gc: &mut GC<OnionObjectCell>, ) -> Result<Box<dyn Runnable>, RuntimeError>

Source

pub fn get_signature(&self) -> &str

Source

pub fn get_parameter(&self) -> &LambdaParameter

Source

pub fn get_flatten_param_keys(&self) -> &[Box<str>]

Source

pub fn get_flatten_param_constraints(&self) -> &[OnionObject]

Source

pub fn get_capture(&self) -> &OnionFastMap<Box<str>, OnionObject>

Source

pub fn get_body(&self) -> &LambdaBody

Source

pub fn upgrade(&self, collected: &mut Vec<GCArc<OnionObjectCell>>)

Source

pub fn with_attribute<F, R>( &self, key: &OnionObject, f: &F, ) -> Result<R, RuntimeError>
where F: Fn(&OnionObject) -> Result<R, RuntimeError>,

Trait Implementations§

Source§

impl Debug for OnionLambdaDefinition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl GCTraceable<OnionObjectCell> for OnionLambdaDefinition

Source§

fn collect(&self, queue: &mut VecDeque<GCArcWeak<OnionObjectCell>>)

collects all reachable objects and adds them to the provided queue.

Auto Trait Implementations§

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.