Skip to main content

Hosted

Struct Hosted 

Source
pub struct Hosted<H: 'static> { /* private fields */ }
Expand description

A loaded blue program whose definitions a host can call.

Implementations§

Source§

impl<H: 'static> Hosted<H>

Source

pub fn defines(&self, name: &str) -> bool

Whether the program defines a callable named name.

Source

pub fn call( &mut self, name: &str, args: Vec<Value>, host: &mut H, ) -> Result<Value, RunError>

Call the definition name with args.

§Errors

RunError::Eval naming the function when it is not defined or is not callable, or with the message it raised.

Source§

impl<H: 'static> Hosted<H>

Source

pub fn call_budgeted( &mut self, name: &str, args: Vec<Value>, host: &mut H, budget: Budget, ) -> Result<Value, CallError>

Call the definition name with args under budget, which starts unspent for this call. Running past it is CallError::Exhausted, told apart from a raise.

§Errors

CallError: the name is not a function, or the call ran out or raised.

Source

pub fn try_call( &mut self, name: &str, args: Vec<Value>, host: &mut H, ) -> Result<Value, CallError>

Auto Trait Implementations§

§

impl<H> !Freeze for Hosted<H>

§

impl<H> !RefUnwindSafe for Hosted<H>

§

impl<H> !UnwindSafe for Hosted<H>

§

impl<H> Send for Hosted<H>
where Interpreter<H>: Send,

§

impl<H> Sync for Hosted<H>
where Interpreter<H>: Sync,

§

impl<H> Unpin for Hosted<H>
where Interpreter<H>: Unpin,

§

impl<H> UnsafeUnpin for Hosted<H>

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.