Struct generator::Scope

source ·
pub struct Scope<'scope, 'a, A, T> { /* private fields */ }
Expand description

passed in scope type it not use the context to pass data, but keep it’s own data ref this struct provide both compile type info and runtime data

Implementations§

source§

impl<'scope, 'a, A, T> Scope<'scope, 'a, A, T>

source

pub fn yield_with(&mut self, v: T)

yield something without catch passed in para

source

pub fn get_yield(&mut self) -> Option<A>

get current generator send para

source

pub unsafe fn yield_unsafe(&mut self, v: T) -> Option<A>

yield and get the send para

§Safety

When yield out, the reference of the captured data must be still valid normally, you should always call the drop of the generator

source

pub unsafe fn yield_from_unsafe(&mut self, g: Generator<'_, A, T>) -> Option<A>

yield_from_unsafe the from generator must has the same type as itself

§Safety

When yield out, the reference of the captured data must be still valid normally, you should always call the drop of the generator

source§

impl<'scope, A, T> Scope<'scope, 'static, A, T>

source

pub fn yield_(&mut self, v: T) -> Option<A>

yield and get the send para

source

pub fn yield_from(&mut self, g: Generator<'_, A, T>) -> Option<A>

yield_from the from generator must has the same type as itself

Auto Trait Implementations§

§

impl<'scope, 'a, A, T> Freeze for Scope<'scope, 'a, A, T>

§

impl<'scope, 'a, A, T> RefUnwindSafe for Scope<'scope, 'a, A, T>

§

impl<'scope, 'a, A, T> Send for Scope<'scope, 'a, A, T>
where A: Send, T: Send,

§

impl<'scope, 'a, A, T> Sync for Scope<'scope, 'a, A, T>
where A: Sync, T: Sync,

§

impl<'scope, 'a, A, T> Unpin for Scope<'scope, 'a, A, T>

§

impl<'scope, 'a, A, T> !UnwindSafe for Scope<'scope, 'a, A, T>

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>,

§

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>,

§

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.