Skip to main content

Native

Struct Native 

Source
pub struct Native<R, O, E> { /* private fields */ }
Expand description

A host over std, reading console input from R and writing console output to O and E.

Implementations§

Source§

impl Native<Stdin, Stdout, Stderr>

Source

pub fn stdio() -> Self

The host over the real standard streams.

Source§

impl Native<Cursor<Vec<u8>>, Vec<u8>, Vec<u8>>

Source

pub fn buffered(input: &[u8]) -> Self

A host in memory: standard input reads input, and the output streams collect what is written to them.

Source§

impl<R, O, E> Native<R, O, E>

Source

pub fn new(stdin: R, stdout: O, stderr: E) -> Self

Source

pub fn stdout(&self) -> &O

What has been written to the standard output stream.

Source

pub fn stderr(&self) -> &E

What has been written to the standard error stream.

Source§

impl<R: Read, O: Write, E: Write> Native<R, O, E>

Source

pub fn perform<A: IVm>( &mut self, command: Any<A>, payload: Any<A>, ) -> Result<Any<A>, Any<A>>

Performs command with payload: the answer is a Result for the continuation. A request that is not one the operation takes is thrown in the language, as the JavaScript runners’ assert ends their loop.

Trait Implementations§

Source§

impl<R: Debug, O: Debug, E: Debug> Debug for Native<R, O, E>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<R, O, E> Freeze for Native<R, O, E>
where R: Freeze, O: Freeze, E: Freeze,

§

impl<R, O, E> RefUnwindSafe for Native<R, O, E>

§

impl<R, O, E> Send for Native<R, O, E>
where R: Send, O: Send, E: Send,

§

impl<R, O, E> Sync for Native<R, O, E>
where R: Sync, O: Sync, E: Sync,

§

impl<R, O, E> Unpin for Native<R, O, E>
where R: Unpin, O: Unpin, E: Unpin,

§

impl<R, O, E> UnsafeUnpin for Native<R, O, E>

§

impl<R, O, E> UnwindSafe for Native<R, O, E>
where R: UnwindSafe, O: UnwindSafe, E: UnwindSafe,

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

Source§

fn to_any<A>(self) -> Any<A>
where A: IVm, Self: Into<Unpacked<A>>,

Source§

impl<T> ToArray for T

Source§

fn to_array<A>(self) -> Array<A>
where A: IVm, Self: Sized + IntoIterator<Item = Any<A>>,

Source§

impl<T> ToObject for T

Source§

fn to_object<A>(self) -> Object<A>
where A: IVm, Self: Sized + IntoIterator<Item = (String<A>, Any<A>)>,

Source§

impl<T> ToString for T

Source§

fn try_to_string<A>(self) -> Result<String<A>, Any<A>>
where A: IVm, Self: Sized + IntoIterator<Item = Result<u16, Any<A>>>,

Source§

fn to_string<A>(self) -> String<A>
where A: IVm, Self: Sized + IntoIterator<Item = u16>,

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.