pub struct ClosureTransition<F, Res = ()> { /* private fields */ }Expand description
A wrapper that adapts a synchronous closure into a Transition.
The closure receives (From, &mut Bus) and returns Outcome<To, E>.
Resources are not passed to the closure — closures that need typed
resources should use a full #[transition] struct instead.
The Res type parameter allows ClosureTransition to be used in
pipelines with any resource type — the resource is simply ignored
during execution.
Implementations§
Trait Implementations§
Source§impl<F: Clone, Res> Clone for ClosureTransition<F, Res>
impl<F: Clone, Res> Clone for ClosureTransition<F, Res>
Source§impl<F, From, To, E, Res> Transition<From, To> for ClosureTransition<F, Res>
impl<F, From, To, E, Res> Transition<From, To> for ClosureTransition<F, Res>
Source§type Resources = Res
type Resources = Res
The type of resources required by this transition.
This follows the “Hard-Wired Types” principle from the Master Plan.
Source§fn run<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: From,
_resources: &'life1 Self::Resources,
bus: &'life2 mut Bus,
) -> Pin<Box<dyn Future<Output = Outcome<To, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn run<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: From,
_resources: &'life1 Self::Resources,
bus: &'life2 mut Bus,
) -> Pin<Box<dyn Future<Output = Outcome<To, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Execute the transition. Read more
Source§fn description(&self) -> Option<String>
fn description(&self) -> Option<String>
Returns a detailed description of what this transition does.
Source§fn position(&self) -> Option<(f32, f32)>
fn position(&self) -> Option<(f32, f32)>
Returns the visual position of this transition in a schematic.
(x, y) coordinates.
Source§fn bus_access_policy(&self) -> Option<BusAccessPolicy>
fn bus_access_policy(&self) -> Option<BusAccessPolicy>
Optional transition-scoped Bus access policy (M143). Read more
Auto Trait Implementations§
impl<F, Res> Freeze for ClosureTransition<F, Res>where
F: Freeze,
impl<F, Res> RefUnwindSafe for ClosureTransition<F, Res>where
F: RefUnwindSafe,
Res: RefUnwindSafe,
impl<F, Res> Send for ClosureTransition<F, Res>
impl<F, Res> Sync for ClosureTransition<F, Res>
impl<F, Res> Unpin for ClosureTransition<F, Res>
impl<F, Res> UnsafeUnpin for ClosureTransition<F, Res>where
F: UnsafeUnpin,
impl<F, Res> UnwindSafe for ClosureTransition<F, Res>where
F: UnwindSafe,
Res: UnwindSafe,
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