[][src]Struct cursive::view::SizeCache

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.

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 inside req.
  • 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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[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]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> With for T[src]