Skip to main content

Parked

Struct Parked 

Source
pub struct Parked<A, RouteSet, Op>
where A: App, RouteSet: Routes<A>, Op: Operation,
{ /* private fields */ }
Expand description

A route for effects handled over a custom, user-owned FFI.

The “opaque typed” lane is for operations whose payloads or results are awkward or undesirable to serialize, such as pointer-style handles or large non-serializable buffers. Instead of bytes, the request is parked under an EffectId with Parked::park, and the shell receives that id together with the (typed) operation. When the shell has a result, it calls Parked::resolve with the id and the typed output.

Parked keeps a Weak reference to its EffectRouter so that resolving a request can advance the runtime and route any follow-up effects.

Implementations§

Source§

impl<App, RouteSet, Op> Parked<App, RouteSet, Op>
where App: App, RouteSet: Routes<App> + Send + Sync + 'static, Op: Operation,

Source

pub fn new(router: Weak<EffectRouter<App, RouteSet>>) -> Self

Create a parked route attached to router.

Called from your Routes::new implementation with the Weak router handle the trait provides.

Source

pub fn resolve( &self, id: EffectId<Op::Output>, output: Op::Output, ) -> Result<(), ResolveError>

Resume a parked request and route any follow-up effects.

§Errors

Returns an error if the underlying request could not be resolved.

§Panics

Panics if the router has been dropped, or the internal registry lock has been poisoned.

Source§

impl<App, RouteSet, Op> Parked<App, RouteSet, Op>
where App: App, RouteSet: Routes<App>, Op: Operation,

Source

pub fn park(&self, request: Request<Op>) -> (EffectId<Op::Output>, Op)

Park a request under an ID for a custom FFI to resume later.

§Panics

Panics if the internal registry lock has been poisoned.

Auto Trait Implementations§

§

impl<A, RouteSet, Op> !Freeze for Parked<A, RouteSet, Op>

§

impl<A, RouteSet, Op> !RefUnwindSafe for Parked<A, RouteSet, Op>

§

impl<A, RouteSet, Op> Send for Parked<A, RouteSet, Op>
where RouteSet: Sync + Send, A: Sync + Send, <A as App>::Model: Send + Sync,

§

impl<A, RouteSet, Op> Sync for Parked<A, RouteSet, Op>
where RouteSet: Sync + Send, A: Sync + Send, <A as App>::Model: Send + Sync,

§

impl<A, RouteSet, Op> Unpin for Parked<A, RouteSet, Op>

§

impl<A, RouteSet, Op> UnsafeUnpin for Parked<A, RouteSet, Op>

§

impl<A, RouteSet, Op> !UnwindSafe for Parked<A, RouteSet, Op>

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

Source§

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

Source§

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.