Skip to main content

Claim

Struct Claim 

Source
pub struct Claim<'a, R: Reducer> { /* private fields */ }
Expand description

A reducer being claimed, and what may still be said about it.

Produced by cx.state::<R>() during install. Ending the chain without driven_by is not a half-finished feature - it is state the UI owns outright, and the type says so: nothing drives it, so nothing can be emitted to it.

Implementations§

Source§

impl<'a, R: Reducer> Claim<'a, R>

Source

pub fn new( scope: Scope, bus: Option<&'a Rc<EventBus>>, token: &'a UiThreadToken, ) -> Self

For a context that hands features their scope - the contexts in guinea-app, and nothing else. bus is the window’s, when the scope is in one.

Source

pub fn seed(self, state: R) -> Self

Starts from something other than R::default().

For a synchronous read - a setting already on disk - so the first frame shows real data instead of defaults followed by a round trip.

Source

pub fn driven_by<A, F>(self, build: F) -> (Bound<R>, Addr<A>)
where F: FnOnce(Push<R>) -> A, A: ManagedActor + Serves + Debug + 'static,

Creates the actor that drives this reducer, and installs it here.

The closure is handed the Push rather than fetching it, and the actor’s lifetime becomes the scope’s - so a feature declares the whole edge in one expression and owns none of the bookkeeping. The actor type is inferred from what the closure returns; neither the reducer nor this call has to name it.

The address comes back for wiring that is the actor’s own, such as addr.subscribe_on::<M>(Bus::Global). The scope still owns the actor and disposes it, and what it subscribed to ends with it.

Source

pub fn plain(self) -> Bound<R>

Leaves it for the feature to drive however it likes.

State the UI owns outright, or a domain that answers with something other than an actor - see cx.answers::<M>(..).

Auto Trait Implementations§

§

impl<'a, R> !RefUnwindSafe for Claim<'a, R>

§

impl<'a, R> !Send for Claim<'a, R>

§

impl<'a, R> !Sync for Claim<'a, R>

§

impl<'a, R> !UnwindSafe for Claim<'a, R>

§

impl<'a, R> Freeze for Claim<'a, R>
where PhantomData<fn() -> R>: Freeze,

§

impl<'a, R> Unpin for Claim<'a, R>
where PhantomData<fn() -> R>: Unpin,

§

impl<'a, R> UnsafeUnpin for Claim<'a, R>
where PhantomData<fn() -> R>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<M> AllowedSignal<M> for M
where M: 'static,

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more