[−][src]Struct cursive::view::SizeCache
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.
Implementations
impl SizeCache
[src]
pub fn new(value: usize, constrained: bool) -> SizeCache
[src]
Creates a new sized cache
pub fn accept(self, request: usize) -> bool
[src]
Returns true
if self
is still valid for the given request
.
pub fn value(self) -> usize
[src]
Returns the value in the cache.
pub fn build(size: XY<usize>, req: XY<usize>) -> XY<SizeCache>
[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 Clone for SizeCache
[src]
impl Copy for SizeCache
[src]
impl Debug for SizeCache
[src]
impl PartialEq<SizeCache> for SizeCache
[src]
impl StructuralPartialEq for SizeCache
[src]
Auto Trait Implementations
impl RefUnwindSafe for SizeCache
impl Send for SizeCache
impl Sync for SizeCache
impl Unpin for SizeCache
impl UnwindSafe for SizeCache
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.