pub struct NodeFnUpdateWithRuntime<F, C>{
pub func: F,
pub runtime: Runtime<C>,
/* private fields */
}Expand description
Wrapper for async functions taking Runtime<C> and returning Result<S::Update, JunctureError>
Form E: async functions that receive Runtime for dependency injection and return a state update.
§Examples
ⓘ
use juncture_core::{IntoNode, State, Runtime};
use juncture_core::node::NodeFnUpdateWithRuntime;
struct MyContext;
struct MyState;
impl State for MyState {
type Update = MyStateUpdate;
}
async fn my_node(state: MyState, runtime: Runtime<MyContext>) -> Result<MyStateUpdate, JunctureError> {
Ok(MyStateUpdate)
}
let node = NodeFnUpdateWithRuntime::new(my_node).into_node("my_node");Fields§
§func: FThe wrapped async function
runtime: Runtime<C>Runtime context to inject into the function
Implementations§
Source§impl<F, C> NodeFnUpdateWithRuntime<F, C>
impl<F, C> NodeFnUpdateWithRuntime<F, C>
Sourcepub const fn new(func: F, runtime: Runtime<C>) -> NodeFnUpdateWithRuntime<F, C>
pub const fn new(func: F, runtime: Runtime<C>) -> NodeFnUpdateWithRuntime<F, C>
Create a new wrapper for a Runtime-aware async function
§Arguments
func- Async function accepting (state, Runtime) runtime- Runtime context to inject
Trait Implementations§
Source§impl<F, C> Debug for NodeFnUpdateWithRuntime<F, C>
impl<F, C> Debug for NodeFnUpdateWithRuntime<F, C>
Source§impl<S, F, Fut, C> IntoNode<S> for NodeFnUpdateWithRuntime<F, C>
impl<S, F, Fut, C> IntoNode<S> for NodeFnUpdateWithRuntime<F, C>
Auto Trait Implementations§
impl<F, C> !RefUnwindSafe for NodeFnUpdateWithRuntime<F, C>
impl<F, C> !UnwindSafe for NodeFnUpdateWithRuntime<F, C>
impl<F, C> Freeze for NodeFnUpdateWithRuntime<F, C>
impl<F, C> Send for NodeFnUpdateWithRuntime<F, C>where
F: Send,
impl<F, C> Sync for NodeFnUpdateWithRuntime<F, C>where
F: Sync,
impl<F, C> Unpin for NodeFnUpdateWithRuntime<F, C>
impl<F, C> UnsafeUnpin for NodeFnUpdateWithRuntime<F, C>where
F: UnsafeUnpin,
C: 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