Generator

Struct Generator 

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

A generator with a stored virtual machine.

Implementations§

Source§

impl Generator

Source

pub fn next(&mut self) -> Result<Option<Value>, VmError>

Get the next value produced by this stream.

Source

pub fn resume(&mut self, value: Value) -> Result<GeneratorState, VmError>

Get the next value produced by this stream.

Source

pub fn into_iterator(self) -> Result<Iterator, VmError>

Convert into iterator

Trait Implementations§

Source§

impl Debug for Generator

Source§

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

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

impl From<Generator> for Value

Source§

fn from(value: Generator) -> Self

Converts to this type from the input type.
Source§

impl FromValue for Generator

Source§

fn from_value(value: Value) -> Result<Self, VmError>

Try to convert to the given type, from the given value.
Source§

impl InstallWith for Generator

Source§

fn install_with(_: &mut Module) -> Result<(), ContextError>

Hook to install more things into the module.
Source§

impl IntoIterator for Generator

Source§

type Item = Result<Value, VmError>

The type of the elements being iterated over.
Source§

type IntoIter = GeneratorIterator

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> GeneratorIterator

Creates an iterator from a value. Read more
Source§

impl Named for Generator

Source§

const BASE_NAME: RawStr

The generic name of the named thing.
Source§

fn full_name() -> String

The exact type name
Source§

impl ToValue for Generator

Source§

fn to_value(self) -> Result<Value, VmError>

Convert into a value.
Source§

impl TypeOf for Generator

Source§

fn type_hash() -> Hash

Convert into a type hash.
Source§

fn type_info() -> TypeInfo

Access diagnostical information on the value type.
Source§

impl UnsafeFromValue for &Generator

Source§

type Output = *const Generator

The output type from the unsafe coercion.
Source§

type Guard = RawRef

The raw guard returned. Read more
Source§

fn from_value(value: Value) -> Result<(Self::Output, Self::Guard), VmError>

Convert the given reference using unsafe assumptions to a value. Read more
Source§

unsafe fn unsafe_coerce(output: Self::Output) -> Self

Coerce the output of an unsafe from value into the final output type. Read more
Source§

impl UnsafeFromValue for &mut Generator

Source§

type Output = *mut Generator

The output type from the unsafe coercion.
Source§

type Guard = RawMut

The raw guard returned. Read more
Source§

fn from_value(value: Value) -> Result<(Self::Output, Self::Guard), VmError>

Convert the given reference using unsafe assumptions to a value. Read more
Source§

unsafe fn unsafe_coerce(output: Self::Output) -> Self

Coerce the output of an unsafe from value into the final output type. Read more

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.
Source§

impl<T> UnsafeFromValue for T
where T: FromValue,

Source§

type Output = T

The output type from the unsafe coercion.
Source§

type Guard = ()

The raw guard returned. Read more
Source§

fn from_value( value: Value, ) -> Result<(T, <T as UnsafeFromValue>::Guard), VmError>

Convert the given reference using unsafe assumptions to a value. Read more
Source§

unsafe fn unsafe_coerce(output: <T as UnsafeFromValue>::Output) -> T

Coerce the output of an unsafe from value into the final output type. Read more
Source§

impl<T> UnsafeToValue for T
where T: ToValue,

Source§

type Guard = ()

The type used to guard the unsafe value conversion.
Source§

unsafe fn unsafe_to_value( self, ) -> Result<(Value, <T as UnsafeToValue>::Guard), VmError>

Convert into a value. Read more