chore: Replace as_any functions with trait upcasting (#28221)
Closes #ISSUE Release Notes: - N/A
This commit is contained in:
parent
38ec45008c
commit
0b75c13034
13 changed files with 23 additions and 87 deletions
|
@ -33,10 +33,6 @@ impl ScrollableHandle for UniformListScrollHandle {
|
|||
fn viewport(&self) -> Bounds<Pixels> {
|
||||
self.0.borrow().base_handle.bounds()
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn Any {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl ScrollableHandle for ListState {
|
||||
|
@ -66,10 +62,6 @@ impl ScrollableHandle for ListState {
|
|||
fn viewport(&self) -> Bounds<Pixels> {
|
||||
self.viewport_bounds()
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn Any {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl ScrollableHandle for ScrollHandle {
|
||||
|
@ -107,10 +99,6 @@ impl ScrollableHandle for ScrollHandle {
|
|||
fn viewport(&self) -> Bounds<Pixels> {
|
||||
self.bounds()
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn Any {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -119,12 +107,11 @@ pub struct ContentSize {
|
|||
pub scroll_adjustment: Option<Point<Pixels>>,
|
||||
}
|
||||
|
||||
pub trait ScrollableHandle: Debug + 'static {
|
||||
pub trait ScrollableHandle: Any + Debug {
|
||||
fn content_size(&self) -> Option<ContentSize>;
|
||||
fn set_offset(&self, point: Point<Pixels>);
|
||||
fn offset(&self) -> Point<Pixels>;
|
||||
fn viewport(&self) -> Bounds<Pixels>;
|
||||
fn as_any(&self) -> &dyn Any;
|
||||
fn drag_started(&self) {}
|
||||
fn drag_ended(&self) {}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue