Skip to main content

PagedView

Struct PagedView 

Source
pub struct PagedView<'a, Msg = Callback> {
    pub count: usize,
    pub axis: Axis,
    pub viewport_fraction: f32,
    pub extent: Option<f32>,
    pub wheel: Option<WheelGeometry>,
    pub requested: usize,
    pub pad_ends: bool,
    pub snapping: bool,
    pub build: &'a dyn Fn(usize) -> Box<dyn Widget<Msg>>,
}
Expand description

The description of a paged view, exposed to the render driver.

Fields§

§count: usize

Total number of pages.

§axis: Axis

Which way the pages are laid out.

§viewport_fraction: f32

The fraction of the viewport one page occupies along that axis.

§extent: Option<f32>

A page extent in pixels, overriding the fraction when set.

A page view states a fraction because a page is a share of the window it is read in. A crate::ListWheel states pixels, because a row of a wheel is a line of text and a line of text is not a share of anything.

§wheel: Option<WheelGeometry>

The cylinder the pages are laid on, when they are laid on one at all — a crate::ListWheel and nothing else. See crate::WheelGeometry.

§requested: usize

The page asked for by the application.

§pad_ends: bool

Room at both ends, so a page narrower than the viewport rests centred in it; see PageView::pad_ends.

§snapping: bool

Does a release come to rest on a page? See PageView::page_snapping.

§build: &'a dyn Fn(usize) -> Box<dyn Widget<Msg>>

Builds one page per index.

Implementations§

Source§

impl<Msg> PagedView<'_, Msg>

Source

pub fn snap(&self, viewport: Rect) -> PageSnap

The snapping description for a viewport of this size.

Source

pub fn end_padding(&self, viewport: Rect) -> f32

The room at each end of the content, in logical pixels.

Zero at the default fraction of one, where a page already fills the viewport and there is nothing to centre.

Auto Trait Implementations§

§

impl<'a, Msg = Callback> !RefUnwindSafe for PagedView<'a, Msg>

§

impl<'a, Msg = Callback> !Send for PagedView<'a, Msg>

§

impl<'a, Msg = Callback> !Sync for PagedView<'a, Msg>

§

impl<'a, Msg = Callback> !UnwindSafe for PagedView<'a, Msg>

§

impl<'a, Msg> Freeze for PagedView<'a, Msg>
where &'a dyn Fn(usize) -> Box<dyn Widget<Msg>>: Freeze,

§

impl<'a, Msg> Unpin for PagedView<'a, Msg>
where &'a dyn Fn(usize) -> Box<dyn Widget<Msg>>: Unpin,

§

impl<'a, Msg> UnsafeUnpin for PagedView<'a, Msg>
where &'a dyn Fn(usize) -> Box<dyn Widget<Msg>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Msg> IntoMsg<Msg> for Msg

Source§

fn defer(work: impl Fn() -> Msg + 'static) -> Msg

The message that stands for work’s result.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.