pub struct VirtualItem {
pub index: usize,
pub size: f64,
pub start: f64,
pub end: f64,
pub key: VirtualKey,
pub lane: usize,
}Expand description
Metadata for a single virtualized item.
Represents the computed layout information that the virtualizer produces for each item within the visible range. Components use this metadata to position and render items in the scroll container.
Fields§
§index: usizeThe index of this item in the full dataset.
size: f64The measured or estimated size of this item in pixels.
Represents height for vertical lists or width for horizontal lists.
start: f64The offset in pixels from the start of the virtualized region.
Represents the top offset for vertical lists or the left offset for horizontal lists.
end: f64The end position in pixels (start + size).
key: VirtualKeyA stable identity key for this item.
When a custom get_item_key is provided, this key follows the
item across reorders. Otherwise it equals the index.
lane: usizeThe lane index for grid layouts (0 for single-column lists).
Implementations§
Source§impl VirtualItem
impl VirtualItem
Sourcepub fn new(index: usize, size: f64, start: f64) -> Self
pub fn new(index: usize, size: f64, start: f64) -> Self
Creates a new virtual item with the given layout parameters.
§Parameters
index: The item’s position in the full dataset.size: The item’s size in pixels along the scroll axis.start: The item’s offset from the start of the virtual region.
Sourcepub fn with_key_and_lane(
index: usize,
size: f64,
start: f64,
key: VirtualKey,
lane: usize,
) -> Self
pub fn with_key_and_lane( index: usize, size: f64, start: f64, key: VirtualKey, lane: usize, ) -> Self
Creates a new virtual item with a specific key and lane.
§Parameters
index: The item’s position in the full dataset.size: The item’s size in pixels along the scroll axis.start: The item’s offset from the start of the virtual region.key: The stable identity key for this item.lane: The lane (column/row) index for grid layouts.
Trait Implementations§
Source§impl Clone for VirtualItem
impl Clone for VirtualItem
Source§fn clone(&self) -> VirtualItem
fn clone(&self) -> VirtualItem
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more