pub struct FnUpstream<F> { /* private fields */ }Expand description
Wrapper that adapts an async function to the Upstream trait.
This allows any async function or closure to be used as the upstream data source in the hitbox caching FSM.
§Example
ⓘ
use hitbox_fn::FnUpstream;
async fn fetch_data(id: u64) -> Data {
// fetch from database
}
let upstream = FnUpstream::new(fetch_data);Implementations§
Source§impl<F> FnUpstream<F>
impl<F> FnUpstream<F>
Trait Implementations§
Source§impl<F, Args, Fut, Res> Upstream<Args> for FnUpstream<F>
impl<F, Args, Fut, Res> Upstream<Args> for FnUpstream<F>
Auto Trait Implementations§
impl<F> Freeze for FnUpstream<F>where
F: Freeze,
impl<F> RefUnwindSafe for FnUpstream<F>where
F: RefUnwindSafe,
impl<F> Send for FnUpstream<F>where
F: Send,
impl<F> Sync for FnUpstream<F>where
F: Sync,
impl<F> Unpin for FnUpstream<F>where
F: Unpin,
impl<F> UnsafeUnpin for FnUpstream<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for FnUpstream<F>where
F: 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