Skip to main content

Arriving

Struct Arriving 

pub struct Arriving<T, E = String> { /* private fields */ }
Expand description

A read whose answer arrives later. Clones share one read.

Build the view with Self::view: it says what shows once the answer is there, and nothing about waiting.

Implementations§

§

impl<T, E> Arriving<T, E>

pub fn ready(value: T) -> Arriving<T, E>

An answer already here.

pub fn pending(from: Source) -> Arriving<T, E>

A read asked now, its answer coming from from. Publish the answer through Self::writer or Self::begin.

pub fn pending_since(from: Source, since: Instant) -> Arriving<T, E>

A read asked at since, its answer coming from from: for a model that keeps when its read began and builds its view again meanwhile.

pub fn with<R>(&self, read: impl FnOnce(&Arrival<T, E>) -> R) -> R

Where the read stands, without exposing its lock.

pub fn get(&self) -> Arrival<T, E>
where T: Clone, E: Clone,

Where the read stands, cloned.

pub fn state(&self) -> LocalState<Arrival<T, E>>

The observable state, for crate::widget::ModelView, Text or a callback that needs the whole arrival.

pub fn revision(&self) -> u64

Advances with every change of the read, for a widget that skips work while nothing changed.

pub fn began(&self) -> Instant

When the read now pending was asked (or when the last one was).

pub fn clock(&self) -> Option<ArrivalClock>

The timing of the read now pending; None once it settled.

pub fn holds_frame_until(&self, now: Instant) -> Option<Instant>

Until when a frame showing this read waits for it at now: while it is a local read inside its frame budget.

pub fn can_retry(&self) -> bool

Whether a retry is offered when the read fails.

pub fn retry(&self)

Ask again after a failure, the way the read was first asked. A read that set no way to retry (Self::on_retry) ignores this.

pub fn on_retry( self, retry: impl Fn(&Arriving<T, E>) + Send + Sync + 'static, ) -> Arriving<T, E>

How to ask again after a failure: retry restarts the read on this handle (usually through Self::begin).

pub fn stand(&self, arrival: Arrival<T, E>)

Say where the read stands, from the thread that holds its data (a record the window follows), with no worker to publish through. A read that settled and is pending again was asked now; one still pending keeps when it was asked, now waiting on from.

§

impl<T, E> Arriving<T, E>
where T: Send + Sync + 'static, E: Send + Sync + 'static,

pub fn writer(&self) -> ArrivalWriter<T, E>

A handle for a producer that publishes more than one answer (an invocation’s updates, pages gathering). It does not restart the read: Self::begin does.

pub fn begin(&self, from: Source) -> ArrivalCompletion<T, E>

Restart the read, its answer now coming from from: every older completion becomes stale before the pending state is published.

pub fn load<F>(&self, from: Source, load: F) -> bool
where F: Future<Output = Result<T, E>> + Send + 'static,

Restart the read with load’s answer, run on the app runtime (tilo_rt::app), never on the calling thread. A later restart aborts it at its next await point.

pub fn local( name: &'static str, load: impl Fn() -> Result<T, E> + Send + Sync + 'static, ) -> Arriving<T, E>
where E: From<String>,

A read of this device’s data: load runs on a background worker (crate::background::Background) and a failure offers a retry that runs it again. A host that runs no background work fails it, saying so.

pub fn read_in_background( &self, name: &'static str, from: Source, load: Arc<dyn Fn() -> Result<T, E> + Send + Sync>, )
where E: From<String>,

Restart the read with load, run on a background worker, its answer coming from from.

§

impl<T, E> Arriving<T, E>
where T: 'static, E: Display + 'static,

pub fn view( &self, build: impl FnMut(&T) -> Box<dyn Widget> + 'static, ) -> ArrivingView

The view of this read: build’s content once the answer is there. Every placeholder and timing on the way is the framework’s (ArrivingView).

Trait Implementations§

§

impl<T, E> Clone for Arriving<T, E>

§

fn clone(&self) -> Arriving<T, E>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<T, E> Debug for Arriving<T, E>

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T, E> Freeze for Arriving<T, E>

§

impl<T, E> RefUnwindSafe for Arriving<T, E>

§

impl<T, E> Send for Arriving<T, E>
where T: Send + Sync, E: Send + Sync,

§

impl<T, E> Sync for Arriving<T, E>
where T: Send + Sync, E: Send + Sync,

§

impl<T, E> Unpin for Arriving<T, E>

§

impl<T, E> UnsafeUnpin for Arriving<T, E>

§

impl<T, E> UnwindSafe for Arriving<T, E>

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
§

impl<T> AsAny for T
where T: 'static,

§

fn as_any(&self) -> &(dyn Any + 'static)

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSend for T
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> CommonTraits for T
where T: AsAny + Any + Debug + WasmNotSendSync,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Fruit for T
where T: Send + Downcast,

§

impl<T> MaybeSendSync for T
where T: Send + Sync + ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T

§

impl<T> WasmNotSync for T
where T: Sync,