Struct Dwell
pub struct Dwell { /* private fields */ }Expand description
How long a transient card has been up for someone to read, which is what its lifetime counts against. The clock runs only while the card is on screen and nobody holds it (the pointer on it, keyboard focus in it): a card that never fit on screen, or one being read, never runs out under the reader. The desktop’s notification banners keep it.
Implementations§
§impl Dwell
impl Dwell
pub fn left(&self, lifetime: Duration, now: Instant) -> Duration
pub fn is_over(&self, lifetime: Duration, now: Instant) -> bool
pub fn is_over(&self, lifetime: Duration, now: Instant) -> bool
Whether a lifetime has run out at now.
pub fn present(&mut self, now: Instant, on_screen: bool, held: bool)
pub fn present(&mut self, now: Instant, on_screen: bool, held: bool)
Say whether the card is on_screen and whether someone held it
at now. The clock runs exactly while it is on screen and unheld.
pub fn spend(&mut self, elapsed: Duration)
pub fn spend(&mut self, elapsed: Duration)
Count elapsed against the card, for a host that advances by
frame deltas rather than reading a clock.
pub fn grant(&mut self, lifetime: Duration, now: Instant, floor: Duration)
pub fn grant(&mut self, lifetime: Duration, now: Instant, floor: Duration)
Leave at least floor of a lifetime at now: a card the person
just let go of gets a moment before it starts to leave, instead of
fading the instant the pointer moves off it.
pub fn ends_at(&self, lifetime: Duration) -> Option<Instant>
pub fn ends_at(&self, lifetime: Duration) -> Option<Instant>
When a lifetime runs out while the clock keeps running; None
while it is stopped.
pub fn first_shown(&self) -> Option<Instant>
pub fn first_shown(&self) -> Option<Instant>
When the card first came on screen; None before it has.
pub fn is_running(&self) -> bool
Trait Implementations§
impl Copy for Dwell
impl Eq for Dwell
impl StructuralPartialEq for Dwell
Auto Trait Implementations§
impl Freeze for Dwell
impl RefUnwindSafe for Dwell
impl Send for Dwell
impl Sync for Dwell
impl Unpin for Dwell
impl UnsafeUnpin for Dwell
impl UnwindSafe for Dwell
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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 Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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