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