Skip to main content

IndicatorItem

Struct IndicatorItem 

Source
pub struct IndicatorItem {
    pub index: usize,
    pub start_offset: f32,
    pub size: f32,
}
Expand description

One row of a ScalingLazyColumn, as ScalingLazyListItemInfo reports it.

Device pixels. Wear’s adapter reads a layout that has already been resolved onto the pixel grid — item heights are whole pixels, the viewport’s centre line is an integer halving — and it divides by those integers. Doing the same arithmetic in points quietly loses the halves, and the halves are what decide which item index the thumb’s ends land on.

scaling_list_items builds these from a laid-out list; a caller that already holds a real ScalingLazyListLayoutInfo can fill them in directly.

Fields§

§index: usize

The row’s index in the whole list.

§start_offset: f32

ScalingLazyListItemInfo.startOffset(ItemCenter): the row’s top edge measured from the viewport’s centre line, after scaling.

§size: f32

ScalingLazyListItemInfo.size: the row’s height after scaling, rounded to a whole pixel. Not the height the row is drawn at — the graphics layer scales by the unrounded scale — but this rounded one is what the layout info reports and therefore what the indicator divides by.

Trait Implementations§

Source§

impl Clone for IndicatorItem

Source§

fn clone(&self) -> IndicatorItem

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for IndicatorItem

Source§

impl Debug for IndicatorItem

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for IndicatorItem

Source§

fn eq(&self, other: &IndicatorItem) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for IndicatorItem

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.