pub struct Generator { /* private fields */ }Expand description
A generator produced by a generator function.
Generator are functions or closures which contain the yield expressions.
§Examples
use std::ops::generator::Generator;
let f = |n| {
yield n;
yield n + 1;
};
let g = f(10);
assert!(g is Generator);Implementations§
Trait Implementations§
Source§impl Any for Generator
impl Any for Generator
Source§const ANY_TYPE_INFO: AnyTypeInfo
const ANY_TYPE_INFO: AnyTypeInfo
The compile-time type information know for the type.
Source§impl Dismantle for Generator
A suspended generator holds every value its machine was working over, so a
generator which captured another one nests just like a container does.
impl Dismantle for Generator
A suspended generator holds every value its machine was working over, so a generator which captured another one nests just like a container does.
Source§impl InstallWith for Generator
impl InstallWith for Generator
Source§fn install_with(module: &mut Module) -> Result<(), ContextError>
fn install_with(module: &mut Module) -> Result<(), ContextError>
Hook to install more things into the module.
Source§impl IntoIterator for Generator
impl IntoIterator for Generator
impl IntoOutput for Generator
Source§impl MaybeTypeOf for Generator
impl MaybeTypeOf for Generator
Source§fn maybe_type_of() -> Result<DocType>
fn maybe_type_of() -> Result<DocType>
Type information for the given type.
Source§impl TypeOf for Generator
impl TypeOf for Generator
Source§const PARAMETERS: Hash
const PARAMETERS: Hash
Type parameters for the type. Read more
Source§const STATIC_TYPE_INFO: AnyTypeInfo = <Self as crate::Any>::ANY_TYPE_INFO
const STATIC_TYPE_INFO: AnyTypeInfo = <Self as crate::Any>::ANY_TYPE_INFO
Access diagnostical type information for the current type. Read more
Source§impl UnsafeToMut for Generator
impl UnsafeToMut for Generator
Source§type Guard = RawValueGuard
type Guard = RawValueGuard
The raw guard returned. Read more
Source§unsafe fn unsafe_to_mut<'a>(
value: Value,
) -> Result<(&'a mut Self, Self::Guard), RuntimeError>
unsafe fn unsafe_to_mut<'a>( value: Value, ) -> Result<(&'a mut Self, Self::Guard), RuntimeError>
Safety Read more
Source§impl UnsafeToRef for Generator
impl UnsafeToRef for Generator
Source§type Guard = RawValueGuard
type Guard = RawValueGuard
The raw guard returned. Read more
Source§unsafe fn unsafe_to_ref<'a>(
value: Value,
) -> Result<(&'a Self, Self::Guard), RuntimeError>
unsafe fn unsafe_to_ref<'a>( value: Value, ) -> Result<(&'a Self, Self::Guard), RuntimeError>
Safety Read more
Source§impl UnsafeToValue for &Generator
impl UnsafeToValue for &Generator
Source§type Guard = ValueRefGuard
type Guard = ValueRefGuard
The type used to guard the unsafe value conversion.
Source§unsafe fn unsafe_to_value(self) -> Result<(Value, Self::Guard), RuntimeError>
unsafe fn unsafe_to_value(self) -> Result<(Value, Self::Guard), RuntimeError>
Convert into a value. Read more
Source§impl UnsafeToValue for &mut Generator
impl UnsafeToValue for &mut Generator
Source§type Guard = ValueMutGuard
type Guard = ValueMutGuard
The type used to guard the unsafe value conversion.
Source§unsafe fn unsafe_to_value(self) -> Result<(Value, Self::Guard), RuntimeError>
unsafe fn unsafe_to_value(self) -> Result<(Value, Self::Guard), RuntimeError>
Convert into a value. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for Generator
impl !Send for Generator
impl !Sync for Generator
impl !UnwindSafe for Generator
impl Forget for Generator
impl Freeze for Generatorwhere
*const ArcInner<RuntimeContext> is !null: Freeze,
PhantomData<ArcInner<RuntimeContext>>: Freeze,
*const ArcInner<Unit> is !null: Freeze,
PhantomData<ArcInner<Unit>>: Freeze,
*const Value is !null: Freeze,
PhantomData<Value>: Freeze,
*const CallFrame is !null: Freeze,
PhantomData<CallFrame>: Freeze,
*const RcInner<GlobalsInner> is !null: Freeze,
PhantomData<RcInner<GlobalsInner>>: Freeze,
*const AnySequenceData<Arc<Rtti>, Value> is !null: Freeze,
*const AnyObjData is !null: Freeze,
*const u8 is !null: Freeze,
PhantomData<Repr>: Freeze,
*const VmExecutionState is !null: Freeze,
PhantomData<VmExecutionState>: Freeze,
impl Move for Generator
impl Unpin for Generatorwhere
*const ArcInner<RuntimeContext> is !null: Unpin,
Align8<usize>: Unpin,
*const u8 is !null: Unpin,
*const () is !null: Unpin,
&'static FunctionHandlerVTable: Unpin,
Box<str>: Unpin,
Box<[u8]>: Unpin,
Box<[Box<str>]>: Unpin,
Box<[ConstNode]>: Unpin,
&'static ConstConstructVtable: Unpin,
*const ArcInner<Unit> is !null: Unpin,
*const Inst is !null: Unpin,
NonZero<usize>: Unpin,
*const Arc<StaticString> is !null: Unpin,
*const ArcInner<StaticString> is !null: Unpin,
*const Vec<u8> is !null: Unpin,
*const Box<[String]> is !null: Unpin,
Box<[String]>: Unpin,
*const Arc<[Address]> is !null: Unpin,
*const ArcInner<[Address]> is !null: Unpin,
*const ArcInner<Rtti> is !null: Unpin,
*const Option<ConstValueBuf> is !null: Unpin,
Box<DebugInfo>: Unpin,
*const Value is !null: Unpin,
*const AnySequenceData<Arc<Rtti>, Value> is !null: Unpin,
*const AnyObjData is !null: Unpin,
*const CallFrame is !null: Unpin,
Rc<GlobalsInner>: Unpin,
*const VmExecutionState is !null: Unpin,
impl UnsafeUnpin for Generatorwhere
*const ArcInner<RuntimeContext> is !null: UnsafeUnpin,
PhantomData<ArcInner<RuntimeContext>>: UnsafeUnpin,
*const ArcInner<Unit> is !null: UnsafeUnpin,
PhantomData<ArcInner<Unit>>: UnsafeUnpin,
*const Value is !null: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
*const CallFrame is !null: UnsafeUnpin,
PhantomData<CallFrame>: UnsafeUnpin,
*const RcInner<GlobalsInner> is !null: UnsafeUnpin,
PhantomData<RcInner<GlobalsInner>>: UnsafeUnpin,
*const AnySequenceData<Arc<Rtti>, Value> is !null: UnsafeUnpin,
*const AnyObjData is !null: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<Repr>: UnsafeUnpin,
*const VmExecutionState is !null: UnsafeUnpin,
PhantomData<VmExecutionState>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FromValue for Twhere
T: AnyMarker,
impl<T> FromValue for Twhere
T: AnyMarker,
Source§fn from_value(value: Value) -> Result<T, RuntimeError>
fn from_value(value: Value) -> Result<T, RuntimeError>
Try to convert to the given type, from the given value.
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoReturn for Twhere
T: ToValue,
impl<T> IntoReturn for Twhere
T: ToValue,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> TryToOwned for Twhere
T: TryClone,
impl<T> TryToOwned for Twhere
T: TryClone,
Source§impl<T> UnsafeToValue for Twhere
T: ToValue,
impl<T> UnsafeToValue for Twhere
T: ToValue,
Source§unsafe fn unsafe_to_value(
self,
) -> Result<(Value, <T as UnsafeToValue>::Guard), RuntimeError>
unsafe fn unsafe_to_value( self, ) -> Result<(Value, <T as UnsafeToValue>::Guard), RuntimeError>
Convert into a value. Read more