Struct Generator

#[repr(transparent)]
pub struct Generator<T = JsValue> { /* private fields */ }

Implementations

impl<T> Generator<T>

fn throw(&self, error: &Error) -> Result<JsValue, JsValue>

The throw() method resumes the execution of a generator by throwing an error into it and returns an object with two properties done and value.

MDN documentation

impl<T> Generator<T>

fn return_(&self, value: &T) -> JsValue
where
    T: ErasableGenericBorrow<JsValue>,

The return() method returns the given value and finishes the generator.

MDN documentation

impl<T> Generator<T>

fn next(&self, value: &T) -> Result<JsValue, JsValue>
where
    T: ErasableGenericBorrow<JsValue>,

The next() method returns an object with two properties done and value. You can also provide a parameter to the next method to send a value to the generator.

MDN documentation

impl<T> Generator<T> where T: FromWasmAbi,

fn throw_value(&self, error: &JsValue) -> Result<IteratorNext<T>, JsValue>
where
    IteratorNext<T>: ErasableGenericOwn<IteratorNext<JsValue>>,

The throw() method resumes the execution of a generator by throwing an error into it and returns an object with two properties done and value.

MDN documentation

impl<T> Generator<T> where T: FromWasmAbi,

fn try_return(&self, value: &T) -> Result<IteratorNext<T>, JsValue>
where
    T: ErasableGenericBorrow<JsValue>,
    IteratorNext<T>: ErasableGenericOwn<IteratorNext<JsValue>>,

The return() method returns the given value and finishes the generator.

MDN documentation

impl<T> Generator<T> where T: FromWasmAbi,

fn next_iterator(&self, value: &T) -> Result<IteratorNext<T>, JsValue>
where
    T: ErasableGenericBorrow<JsValue>,
    IteratorNext<T>: ErasableGenericOwn<IteratorNext<JsValue>>,

The next() method returns an object with two properties done and value. You can also provide a parameter to the next method to send a value to the generator.

MDN documentation

Trait Implementations

impl From<JsValue> for Generator

fn from(obj: JsValue) -> Self

impl<T> AsRef<Generator<T>> for Generator<T>

fn as_ref(&self) -> &Generator<T>

impl<T> AsRef<JsValue> for Generator<T>

fn as_ref(&self) -> &JsValue

impl<T> AsRef<Object> for Generator<T>

fn as_ref(&self) -> &Object

impl<T> Deref for Generator<T>

type Target = Object;
fn deref(&self) -> &Object

impl<T> ErasableGeneric for Generator<T>

type Repr = JsValue;

impl<T> FromWasmAbi for Generator<T>

type Abi = <JsValue as FromWasmAbi>::Abi;
unsafe fn from_abi(js: Self::Abi) -> Self

impl<T> IntoJsGeneric for Generator<T> where Generator<T>: JsGeneric,

type JsCanon = Generator<T>;
fn to_js(self) -> Generator<T>

impl<T> IntoWasmAbi for Generator<T>

type Abi = <JsValue as IntoWasmAbi>::Abi;
fn into_abi(self) -> Self::Abi

impl<T> JsCast for Generator<T>

fn instanceof(val: &JsValue) -> bool
fn unchecked_from_js(val: JsValue) -> Self
fn unchecked_from_js_ref(val: &JsValue) -> &Self

impl<T> LongRefFromWasmAbi for Generator<T>

type Abi = <JsValue as LongRefFromWasmAbi>::Abi;
type Anchor = Generator<T>;
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor

impl<T> OptionFromWasmAbi for Generator<T>

fn is_none(abi: &Self::Abi) -> bool

impl<T> OptionIntoWasmAbi for Generator<T>

fn none() -> Self::Abi

impl<T> Promising for Generator<T>

type Resolution = Generator<T>;

impl<T> RefFromWasmAbi for Generator<T>

type Abi = <JsValue as RefFromWasmAbi>::Abi;
type Anchor = ManuallyDrop<Generator<T>>;
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor

impl<T> WasmDescribe for Generator<T>

fn describe()

impl<T, __UpcastTarget0> UpcastFrom<Generator<T>> for Generator<__UpcastTarget0> where __UpcastTarget0: UpcastFrom<T>,

impl<T: Clone> Clone for Generator<T>

fn clone(&self) -> Self

impl<T: Debug> Debug for Generator<T>

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

impl<T: Eq> Eq for Generator<T>

impl<T: FromWasmAbi> Iterable for Generator<T>

type Item = T;

impl<T: PartialEq> PartialEq for Generator<T>

fn eq(&self, other: &Self) -> bool

impl<T: PartialEq> StructuralPartialEq for Generator<T>

Auto Trait Implementations

impl<T> Freeze for Generator<T> where PhantomData<(T,)>: Freeze,

impl<T> RefUnwindSafe for Generator<T> where PhantomData<(T,)>: RefUnwindSafe,

impl<T> Send for Generator<T> where PhantomData<(T,)>: Send,

impl<T> Sync for Generator<T> where PhantomData<(T,)>: Sync,

impl<T> Unpin for Generator<T> where PhantomData<(T,)>: Unpin,

impl<T> UnsafeUnpin for Generator<T> where PhantomData<(T,)>: UnsafeUnpin,

impl<T> UnwindSafe for Generator<T> where PhantomData<(T,)>: UnwindSafe,

Blanket Implementations

impl<P, T> Receiver for Generator<T> where P: Deref<Target = T> + ?Sized, T: ?Sized,

impl<S, T> Upcast<T> for Generator<T> where T: UpcastFrom<S> + ?Sized, S: ?Sized,

impl<T> Any for Generator<T> where T: 'static + ?Sized,

impl<T> Borrow<T> for Generator<T> where T: ?Sized,

impl<T> BorrowMut<T> for Generator<T> where T: ?Sized,

impl<T> CloneToUninit for Generator<T> where T: Clone,

impl<T> From<T> for Generator<T>

impl<T> JsGeneric for Generator<T> where T: ErasableGeneric<Repr = JsValue> + UpcastFrom<T> + Upcast<JsValue> + JsCast + 'static,

impl<T> ReturnWasmAbi for Generator<T> where T: IntoWasmAbi,

impl<T> ToOwned for Generator<T> where T: Clone,

impl<T> TryFromJsValue for Generator<T> where T: JsCast,

impl<T> VectorFromWasmAbi for Generator<T> where T: ErasableGeneric<Repr = JsValue> + WasmDescribe,

impl<T> VectorIntoWasmAbi for Generator<T> where T: ErasableGeneric<Repr = JsValue> + WasmDescribe,

impl<T> VectorRefIntoWasmAbi for Generator<T> where &'a T: for<'a> Into<JsValue>,

impl<T, U> Into<U> for Generator<T> where U: From<T>,

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

impl<T, U> TryInto<U> for Generator<T> where U: TryFrom<T>,