Struct cursive::view::SizeCache
[−]
[src]
pub struct SizeCache { pub value: usize, pub constrained: bool, }
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.
Methods
impl SizeCache
[src]
fn new(value: usize, constrained: bool) -> Self
[src]
Creates a new sized cache
fn accept(self, request: usize) -> bool
[src]
Returns true
if self
is still valid for the given request
.
fn value(self) -> usize
[src]
Returns the value in the cache.
fn build(size: Vec2, req: Vec2) -> XY<Self>
[src]
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)
Trait Implementations
impl PartialEq for SizeCache
[src]
fn eq(&self, __arg_0: &SizeCache) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &SizeCache) -> bool
[src]
This method tests for !=
.
impl Debug for SizeCache
[src]
impl Clone for SizeCache
[src]
fn clone(&self) -> SizeCache
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more