Struct cursive::view::SizeCache [−][src]
Expand description
Cache around a one-dimensional layout result.
This is not a View, but something to help you if you create your own Views.
Fields
value: usize
Cached value
constrained: bool
true
if the last size was constrained.
If unconstrained, any request larger than this value would return the same size.
extra: T
Extra field.
Implementations
Creates a new bi-dimensional cache.
It will stay valid for the same request, and compatible ones.
A compatible request is one where, for each axis, either:
- the request is equal to the cached size, or
- the request is larger than the cached size and the cache is unconstrained
Notes:
size
must fit insidereq
.- for each dimension,
constrained = (size == req)
Creates a new sized cache
Creates a new bi-dimensional cache.
Similar to build()
, but includes the extra field.
Returns true
if self
is still valid for the given request
.
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for SizeCache<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for SizeCache<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Calls the given closure and return the result. Read more
Calls the given closure on self
.