pub struct AnchorResolver;Expand description
Resolves anchors against a live index. Stateless — the buffer calls these as associated functions.
Implementations§
Source§impl AnchorResolver
impl AnchorResolver
Sourcepub fn to_pixels(
anchor: &ScrollAnchor,
index: &mut HeightIndex,
viewport_height: u32,
row_of: impl Fn(MessageId) -> Option<usize>,
) -> u64
pub fn to_pixels( anchor: &ScrollAnchor, index: &mut HeightIndex, viewport_height: u32, row_of: impl Fn(MessageId) -> Option<usize>, ) -> u64
The pixel value the scroll adjustment should report.
row_of maps a MessageId to its current row position, which
only the buffer knows. Returns a value already clamped to
[0, total - viewport].
Sourcepub fn from_pixels(
y: u64,
index: &mut HeightIndex,
viewport_height: u32,
follow_slop: u32,
id_of_row: impl Fn(usize) -> Option<MessageId>,
) -> ScrollAnchor
pub fn from_pixels( y: u64, index: &mut HeightIndex, viewport_height: u32, follow_slop: u32, id_of_row: impl Fn(usize) -> Option<MessageId>, ) -> ScrollAnchor
Build an anchor from a pixel position — what a scrollbar drag produces.
Snapping to Gravity::Bottom when the position is within
follow_slop of the end is what makes “scroll to the bottom and
it starts following again” work, and it is why the slop exists at
all: landing one pixel short of the end should not silently stop
following.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AnchorResolver
impl RefUnwindSafe for AnchorResolver
impl Send for AnchorResolver
impl Sync for AnchorResolver
impl Unpin for AnchorResolver
impl UnsafeUnpin for AnchorResolver
impl UnwindSafe for AnchorResolver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more