Trait anchors::expert::UpdateContext[][src]

pub trait UpdateContext {
    type Engine: Engine + ?Sized;
    fn get<'out, 'slf, O: 'static>(
        &'slf self,
        anchor: &Anchor<O, Self::Engine>
    ) -> &'out O
    where
        'slf: 'out
;
fn request<'out, O: 'static>(
        &mut self,
        anchor: &Anchor<O, Self::Engine>,
        necessary: bool
    ) -> Poll;
fn unrequest<'out, O: 'static>(&mut self, anchor: &Anchor<O, Self::Engine>);
fn dirty_handle(&mut self) -> <Self::Engine as Engine>::DirtyHandle; }

The context passed to an AnchorInner when its poll_updated method is called.

Associated Types

Loading content...

Required methods

fn get<'out, 'slf, O: 'static>(
    &'slf self,
    anchor: &Anchor<O, Self::Engine>
) -> &'out O where
    'slf: 'out, 
[src]

If request indicates another Anchor’s value is ready, the previously calculated value can be accessed with this method.

fn request<'out, O: 'static>(
    &mut self,
    anchor: &Anchor<O, Self::Engine>,
    necessary: bool
) -> Poll
[src]

If anchor’s output is ready, indicates whether the output has changed since this AnchorInner last called request on it. If anchor’s output is not ready, it is queued for recalculation and this returns Poll::Pending.

necessary is a bit that indicates if we are necessary, anchor should be marked as necessary as well. If you don’t know what this bit should be set to, you probably want a value of true.

fn unrequest<'out, O: 'static>(&mut self, anchor: &Anchor<O, Self::Engine>)[src]

If anchor was previously passed to request and you no longer care about its output, you can pass it to unrequest so the engine will stop calling your dirty method when anchor changes. If self is necessary, this is also critical for ensuring anchor is no longer marked as necessary.

fn dirty_handle(&mut self) -> <Self::Engine as Engine>::DirtyHandle[src]

Returns a new dirty handle, used for marking that self’s output may have changed through some non incremental means. For instance, perhaps this AnchorInners value represents the current time, or it’s a Var that has a setter function.

Loading content...

Implementors

Loading content...