Skip to main content

ListView

Struct ListView 

Source
pub struct ListView<DataSource, Delegate> { /* private fields */ }
Expand description

Scrollable data-driven list view.

Implementations§

Source§

impl<DataSource, Delegate> ListView<DataSource, Delegate>
where DataSource: ListDataSource,

Source

pub fn handle_touch<'text>( &mut self, touch: TouchEvent, viewport: Rectangle, ) -> ListEvent<Delegate::Message>
where Delegate: ListDelegate<'text, DataSource::ItemId>,

Routes one touch event to the list.

Examples found in repository?
examples/uikit_root.rs (line 79)
72    fn handle_touch(
73        &mut self,
74        touch: TouchEvent,
75        registration: &ViewRegistration<'static, DemoViewId, 2>,
76        _env: &ViewEnvironment<'_, 'static>,
77    ) -> ViewEvent<DemoMessage> {
78        self.list
79            .handle_touch(touch, registration.children()[0].frame)
80            .into_view_event()
81    }
More examples
Hide additional examples
examples/scroll_and_list.rs (lines 80-83)
60fn main() {
61    let mut canvas = support::NullCanvas::new(Size::new(320, 240));
62    let viewport = Rectangle::new(Point::new(16, 16), Size::new(180, 160));
63
64    let mut scroll = ScrollView::new();
65    scroll.begin_drag(TouchEvent::new(Point::new(8, 8), TouchPhase::Start, 1));
66    let _ = scroll.drag(
67        TouchEvent::new(Point::new(8, 32), TouchPhase::Move, 2),
68        420,
69        160,
70    );
71    let _ = scroll.end_drag(
72        TouchEvent::new(Point::new(8, 32), TouchPhase::End, 3),
73        420,
74        160,
75    );
76    let _ = scroll.tick(16, 420, 160);
77    let _ = scroll.scroll_bar(viewport, 420);
78
79    let mut list = ListView::new(DemoDataSource, DemoDelegate);
80    let _ = list.handle_touch(
81        TouchEvent::new(Point::new(24, 24), TouchPhase::Start, 10),
82        viewport,
83    );
84    let _ = list.handle_touch(
85        TouchEvent::new(Point::new(24, 60), TouchPhase::Move, 11),
86        viewport,
87    );
88    let _ = list.handle_touch(
89        TouchEvent::new(Point::new(24, 60), TouchPhase::End, 12),
90        viewport,
91    );
92    list.draw(
93        &mut canvas,
94        viewport,
95        &ViewEnvironment {
96            theme: &support::theme(),
97            i18n: &support::i18n(),
98        },
99    );
100}
Source

pub fn item_at_point( &self, point: Point, viewport: Rectangle, ) -> Option<ListSelection<DataSource::ItemId>>

Returns the selected item at a given point, if any.

Source§

impl<DataSource, Delegate> ListView<DataSource, Delegate>
where DataSource: ListDataSource,

Source

pub fn content_offset_y(&self) -> i32

Returns the rounded vertical content offset.

Source

pub fn content_height(&self) -> u32

Returns the total content height.

Examples found in repository?
src/list_view/render.rs (line 73)
72    pub fn scroll_bar(&self, viewport: Rectangle) -> Option<ScrollBar> {
73        self.scroll_view.scroll_bar(viewport, self.content_height())
74    }
75
76    /// Returns the dirty rect for indicator updates, if any.
77    pub fn scroll_bar_dirty(&self, viewport: Rectangle) -> Option<Rectangle> {
78        self.scroll_view
79            .scroll_bar_dirty(viewport, self.content_height())
80    }
81
82    /// Returns the content rect used for scroll blitting.
83    pub fn motion_content_rect(&self, viewport: Rectangle) -> Rectangle {
84        self.scroll_view
85            .motion_content_rect(viewport, self.content_height())
86    }
87
88    /// Advances list animation state.
89    pub fn tick(&mut self, dt_ms: u32, viewport: Rectangle) -> ViewRedraw {
90        if self
91            .scroll_view
92            .tick(dt_ms, self.content_height(), viewport.size.height)
93        {
94            ViewRedraw::Dirty(viewport)
95        } else {
96            ViewRedraw::None
97        }
98    }
99
100    /// Returns the frame for one item index, even if only partially visible.
101    pub fn item_frame(&self, index: usize, viewport: Rectangle) -> Option<Rectangle> {
102        if index >= self.data_source.item_count() {
103            return None;
104        }
105
106        let mut cursor = self.scroll_view.content_offset_y();
107        for current in 0..self.data_source.item_count() {
108            let height = self.data_source.item_height(current);
109            let frame = Rectangle::new(
110                Point::new(viewport.top_left.x, viewport.top_left.y + cursor),
111                Size::new(viewport.size.width, height),
112            );
113            if current == index {
114                return Some(frame);
115            }
116            cursor += height as i32;
117        }
118        None
119    }
120
121    /// Draws the list and its scroll indicator.
122    pub fn draw<'text, D>(
123        &self,
124        display: &mut D,
125        viewport: Rectangle,
126        env: &ViewEnvironment<'_, 'text>,
127    ) where
128        D: DrawTarget<Color = Rgb565>,
129        Delegate: ListDelegate<'text, DataSource::ItemId>,
130    {
131        let mut cursor = self.scroll_view.content_offset_y();
132        let mut clipped = display.clipped(&viewport);
133        for index in 0..self.data_source.item_count() {
134            let height = self.data_source.item_height(index);
135            let frame = Rectangle::new(
136                Point::new(viewport.top_left.x, viewport.top_left.y + cursor),
137                Size::new(viewport.size.width, height),
138            );
139            if rects_intersect(frame, viewport) {
140                self.delegate.draw_row(
141                    &mut clipped,
142                    ListRow {
143                        item: ListItem {
144                            id: self.data_source.item_id(index),
145                            index,
146                            frame,
147                        },
148                        state: ListRowState {
149                            selected: self.selected_index() == Some(index),
150                            highlighted: self.highlighted_index == Some(index),
151                        },
152                    },
153                    env,
154                );
155            }
156            cursor += height as i32;
157        }
158        self.scroll_view
159            .draw_scroll_bar(display, viewport, self.content_height(), env.theme);
160    }
More examples
Hide additional examples
src/list_view/interaction.rs (line 45)
12    pub fn handle_touch<'text>(
13        &mut self,
14        touch: TouchEvent,
15        viewport: Rectangle,
16    ) -> ListEvent<Delegate::Message>
17    where
18        Delegate: ListDelegate<'text, DataSource::ItemId>,
19    {
20        if !touch.within(viewport) && !self.scroll_view.is_dragging() {
21            return ListEvent::none();
22        }
23
24        let local_touch = offset_touch(touch, viewport.top_left);
25        let touched_index = self.item_index_at_point(touch.point, viewport);
26        let was_dragging = self.scroll_view.is_dragging();
27        let previous_highlight = self.highlighted_index;
28        let previous_selection = self.selected_index;
29        let mut activity = ListActivity::None;
30        let mut message = None;
31
32        let scrolled = match touch.phase {
33            TouchPhase::Start => {
34                self.touch_started_inside = touch.within(viewport);
35                self.tap_candidate = self.touch_started_inside;
36                self.scroll_view.begin_drag(local_touch);
37                message = message.or(
38                    self.set_highlighted_index(touched_index.filter(|_| self.touch_started_inside))
39                );
40                false
41            }
42            TouchPhase::Move => {
43                let changed =
44                    self.scroll_view
45                        .drag(local_touch, self.content_height(), viewport.size.height);
46                if changed || self.scroll_view.is_scrolling() {
47                    self.tap_candidate = false;
48                    message = message.or(self.set_highlighted_index(None));
49                } else {
50                    let next_highlight = if self.touch_started_inside && touch.within(viewport) {
51                        touched_index
52                    } else {
53                        None
54                    };
55                    message = message.or(self.set_highlighted_index(next_highlight));
56                }
57                changed
58            }
59            TouchPhase::End | TouchPhase::Cancel => {
60                let changed = self.scroll_view.end_drag(
61                    local_touch,
62                    self.content_height(),
63                    viewport.size.height,
64                );
65
66                if matches!(touch.phase, TouchPhase::End)
67                    && self.touch_started_inside
68                    && self.tap_candidate
69                    && touch.within(viewport)
70                {
71                    if let Some(index) = touched_index {
72                        if self.allows_selection {
73                            self.selected_index = Some(index);
74                        }
75                        if let Some(selection) = self.selection_for_index(index) {
76                            message = message.or(self.delegate.did_select_item(selection));
77                        }
78                    }
79                }
80
81                message = message.or(self.set_highlighted_index(None));
82                self.touch_started_inside = false;
83                self.tap_candidate = false;
84                changed
85            }
86        };
87
88        let visual_state_changed = previous_highlight != self.highlighted_index
89            || previous_selection != self.selected_index;
90        let motion_active = scrolled || self.scroll_view.is_scrolling();
91
92        if motion_active {
93            activity = ListActivity::Motion;
94        } else if visual_state_changed {
95            activity = ListActivity::Interactive;
96        }
97
98        ListEvent {
99            redraw: match activity {
100                ListActivity::None => ViewRedraw::None,
101                ListActivity::Interactive | ListActivity::Motion => ViewRedraw::Dirty(viewport),
102            },
103            captured: was_dragging || touch.within(viewport) || self.touch_started_inside,
104            message,
105            activity,
106        }
107    }
Source

pub fn selected_index(&self) -> Option<usize>

Returns the selected row index, if any.

Examples found in repository?
src/list_view/render.rs (line 38)
37    pub fn selected_item(&self) -> Option<ListSelection<DataSource::ItemId>> {
38        self.selection_for_index(self.selected_index()?)
39    }
40
41    /// Returns the highlighted row payload, if any.
42    pub fn highlighted_item(&self) -> Option<ListSelection<DataSource::ItemId>> {
43        self.selection_for_index(self.highlighted_index?)
44    }
45
46    /// Sets the selected row index.
47    pub fn set_selected_index(&mut self, index: Option<usize>) -> bool {
48        let normalized = index.filter(|index| *index < self.data_source.item_count());
49        if self.selected_index == normalized {
50            return false;
51        }
52        self.selected_index = normalized;
53        true
54    }
55
56    /// Clears row selection.
57    pub fn clear_selection(&mut self) -> bool {
58        self.set_selected_index(None)
59    }
60
61    /// Returns whether the vertical indicator is enabled.
62    pub fn shows_vertical_scroll_indicator(&self) -> bool {
63        self.scroll_view.shows_vertical_scroll_indicator()
64    }
65
66    /// Enables or disables the vertical indicator.
67    pub fn set_shows_vertical_scroll_indicator(&mut self, shows: bool) {
68        self.scroll_view.set_shows_vertical_scroll_indicator(shows);
69    }
70
71    /// Returns the current scrollbar thumb, if visible.
72    pub fn scroll_bar(&self, viewport: Rectangle) -> Option<ScrollBar> {
73        self.scroll_view.scroll_bar(viewport, self.content_height())
74    }
75
76    /// Returns the dirty rect for indicator updates, if any.
77    pub fn scroll_bar_dirty(&self, viewport: Rectangle) -> Option<Rectangle> {
78        self.scroll_view
79            .scroll_bar_dirty(viewport, self.content_height())
80    }
81
82    /// Returns the content rect used for scroll blitting.
83    pub fn motion_content_rect(&self, viewport: Rectangle) -> Rectangle {
84        self.scroll_view
85            .motion_content_rect(viewport, self.content_height())
86    }
87
88    /// Advances list animation state.
89    pub fn tick(&mut self, dt_ms: u32, viewport: Rectangle) -> ViewRedraw {
90        if self
91            .scroll_view
92            .tick(dt_ms, self.content_height(), viewport.size.height)
93        {
94            ViewRedraw::Dirty(viewport)
95        } else {
96            ViewRedraw::None
97        }
98    }
99
100    /// Returns the frame for one item index, even if only partially visible.
101    pub fn item_frame(&self, index: usize, viewport: Rectangle) -> Option<Rectangle> {
102        if index >= self.data_source.item_count() {
103            return None;
104        }
105
106        let mut cursor = self.scroll_view.content_offset_y();
107        for current in 0..self.data_source.item_count() {
108            let height = self.data_source.item_height(current);
109            let frame = Rectangle::new(
110                Point::new(viewport.top_left.x, viewport.top_left.y + cursor),
111                Size::new(viewport.size.width, height),
112            );
113            if current == index {
114                return Some(frame);
115            }
116            cursor += height as i32;
117        }
118        None
119    }
120
121    /// Draws the list and its scroll indicator.
122    pub fn draw<'text, D>(
123        &self,
124        display: &mut D,
125        viewport: Rectangle,
126        env: &ViewEnvironment<'_, 'text>,
127    ) where
128        D: DrawTarget<Color = Rgb565>,
129        Delegate: ListDelegate<'text, DataSource::ItemId>,
130    {
131        let mut cursor = self.scroll_view.content_offset_y();
132        let mut clipped = display.clipped(&viewport);
133        for index in 0..self.data_source.item_count() {
134            let height = self.data_source.item_height(index);
135            let frame = Rectangle::new(
136                Point::new(viewport.top_left.x, viewport.top_left.y + cursor),
137                Size::new(viewport.size.width, height),
138            );
139            if rects_intersect(frame, viewport) {
140                self.delegate.draw_row(
141                    &mut clipped,
142                    ListRow {
143                        item: ListItem {
144                            id: self.data_source.item_id(index),
145                            index,
146                            frame,
147                        },
148                        state: ListRowState {
149                            selected: self.selected_index() == Some(index),
150                            highlighted: self.highlighted_index == Some(index),
151                        },
152                    },
153                    env,
154                );
155            }
156            cursor += height as i32;
157        }
158        self.scroll_view
159            .draw_scroll_bar(display, viewport, self.content_height(), env.theme);
160    }
Source

pub fn selected_item(&self) -> Option<ListSelection<DataSource::ItemId>>

Returns the selected row payload, if any.

Source

pub fn highlighted_item(&self) -> Option<ListSelection<DataSource::ItemId>>

Returns the highlighted row payload, if any.

Source

pub fn set_selected_index(&mut self, index: Option<usize>) -> bool

Sets the selected row index.

Examples found in repository?
src/list_view/render.rs (line 58)
57    pub fn clear_selection(&mut self) -> bool {
58        self.set_selected_index(None)
59    }
Source

pub fn clear_selection(&mut self) -> bool

Clears row selection.

Source

pub fn shows_vertical_scroll_indicator(&self) -> bool

Returns whether the vertical indicator is enabled.

Source

pub fn set_shows_vertical_scroll_indicator(&mut self, shows: bool)

Enables or disables the vertical indicator.

Source

pub fn scroll_bar(&self, viewport: Rectangle) -> Option<ScrollBar>

Returns the current scrollbar thumb, if visible.

Source

pub fn scroll_bar_dirty(&self, viewport: Rectangle) -> Option<Rectangle>

Returns the dirty rect for indicator updates, if any.

Source

pub fn motion_content_rect(&self, viewport: Rectangle) -> Rectangle

Returns the content rect used for scroll blitting.

Source

pub fn tick(&mut self, dt_ms: u32, viewport: Rectangle) -> ViewRedraw

Advances list animation state.

Examples found in repository?
examples/uikit_root.rs (line 69)
62    fn update(
63        &mut self,
64        dt_ms: u32,
65        registration: &ViewRegistration<'static, DemoViewId, 2>,
66        _env: &ViewEnvironment<'_, 'static>,
67    ) -> ViewEvent<DemoMessage> {
68        let list = registration.children()[0].frame;
69        ViewEvent::redraw(self.list.tick(dt_ms, list))
70    }
Source

pub fn item_frame(&self, index: usize, viewport: Rectangle) -> Option<Rectangle>

Returns the frame for one item index, even if only partially visible.

Source

pub fn draw<'text, D>( &self, display: &mut D, viewport: Rectangle, env: &ViewEnvironment<'_, 'text>, )
where D: DrawTarget<Color = Rgb565>, Delegate: ListDelegate<'text, DataSource::ItemId>,

Draws the list and its scroll indicator.

Examples found in repository?
examples/uikit_root.rs (line 92)
83    fn draw<D>(
84        &self,
85        display: &mut D,
86        registration: &ViewRegistration<'static, DemoViewId, 2>,
87        env: &ViewEnvironment<'_, 'static>,
88    ) where
89        D: DrawTarget<Color = Rgb565>,
90    {
91        self.list
92            .draw(display, registration.children()[0].frame, env);
93    }
More examples
Hide additional examples
examples/scroll_and_list.rs (lines 92-99)
60fn main() {
61    let mut canvas = support::NullCanvas::new(Size::new(320, 240));
62    let viewport = Rectangle::new(Point::new(16, 16), Size::new(180, 160));
63
64    let mut scroll = ScrollView::new();
65    scroll.begin_drag(TouchEvent::new(Point::new(8, 8), TouchPhase::Start, 1));
66    let _ = scroll.drag(
67        TouchEvent::new(Point::new(8, 32), TouchPhase::Move, 2),
68        420,
69        160,
70    );
71    let _ = scroll.end_drag(
72        TouchEvent::new(Point::new(8, 32), TouchPhase::End, 3),
73        420,
74        160,
75    );
76    let _ = scroll.tick(16, 420, 160);
77    let _ = scroll.scroll_bar(viewport, 420);
78
79    let mut list = ListView::new(DemoDataSource, DemoDelegate);
80    let _ = list.handle_touch(
81        TouchEvent::new(Point::new(24, 24), TouchPhase::Start, 10),
82        viewport,
83    );
84    let _ = list.handle_touch(
85        TouchEvent::new(Point::new(24, 60), TouchPhase::Move, 11),
86        viewport,
87    );
88    let _ = list.handle_touch(
89        TouchEvent::new(Point::new(24, 60), TouchPhase::End, 12),
90        viewport,
91    );
92    list.draw(
93        &mut canvas,
94        viewport,
95        &ViewEnvironment {
96            theme: &support::theme(),
97            i18n: &support::i18n(),
98        },
99    );
100}
Source§

impl<DataSource, Delegate> ListView<DataSource, Delegate>

Source

pub fn new(data_source: DataSource, delegate: Delegate) -> Self

Creates a list view from a data source and delegate.

Examples found in repository?
examples/uikit_root.rs (line 36)
34    fn new() -> Self {
35        Self {
36            list: ListView::new(DeviceDataSource, DeviceDelegate),
37        }
38    }
More examples
Hide additional examples
examples/scroll_and_list.rs (line 79)
60fn main() {
61    let mut canvas = support::NullCanvas::new(Size::new(320, 240));
62    let viewport = Rectangle::new(Point::new(16, 16), Size::new(180, 160));
63
64    let mut scroll = ScrollView::new();
65    scroll.begin_drag(TouchEvent::new(Point::new(8, 8), TouchPhase::Start, 1));
66    let _ = scroll.drag(
67        TouchEvent::new(Point::new(8, 32), TouchPhase::Move, 2),
68        420,
69        160,
70    );
71    let _ = scroll.end_drag(
72        TouchEvent::new(Point::new(8, 32), TouchPhase::End, 3),
73        420,
74        160,
75    );
76    let _ = scroll.tick(16, 420, 160);
77    let _ = scroll.scroll_bar(viewport, 420);
78
79    let mut list = ListView::new(DemoDataSource, DemoDelegate);
80    let _ = list.handle_touch(
81        TouchEvent::new(Point::new(24, 24), TouchPhase::Start, 10),
82        viewport,
83    );
84    let _ = list.handle_touch(
85        TouchEvent::new(Point::new(24, 60), TouchPhase::Move, 11),
86        viewport,
87    );
88    let _ = list.handle_touch(
89        TouchEvent::new(Point::new(24, 60), TouchPhase::End, 12),
90        viewport,
91    );
92    list.draw(
93        &mut canvas,
94        viewport,
95        &ViewEnvironment {
96            theme: &support::theme(),
97            i18n: &support::i18n(),
98        },
99    );
100}
Source

pub const fn scroll_view(&self) -> &ScrollView

Returns the underlying scroll view.

Source

pub fn scroll_view_mut(&mut self) -> &mut ScrollView

Returns the underlying scroll view mutably.

Source

pub const fn state(&self) -> &ScrollViewState

Returns the underlying scroll state.

Source

pub fn state_mut(&mut self) -> &mut ScrollViewState

Returns the underlying scroll state mutably.

Source

pub const fn data_source(&self) -> &DataSource

Returns the list data source.

Source

pub fn data_source_mut(&mut self) -> &mut DataSource

Returns the list data source mutably.

Source

pub const fn delegate(&self) -> &Delegate

Returns the list delegate.

Source

pub fn delegate_mut(&mut self) -> &mut Delegate

Returns the list delegate mutably.

Source

pub const fn allows_selection(&self) -> bool

Returns whether row selection is enabled.

Source

pub fn set_allows_selection(&mut self, allows_selection: bool)

Enables or disables row selection.

Auto Trait Implementations§

§

impl<DataSource, Delegate> Freeze for ListView<DataSource, Delegate>
where DataSource: Freeze, Delegate: Freeze,

§

impl<DataSource, Delegate> RefUnwindSafe for ListView<DataSource, Delegate>
where DataSource: RefUnwindSafe, Delegate: RefUnwindSafe,

§

impl<DataSource, Delegate> Send for ListView<DataSource, Delegate>
where DataSource: Send, Delegate: Send,

§

impl<DataSource, Delegate> Sync for ListView<DataSource, Delegate>
where DataSource: Sync, Delegate: Sync,

§

impl<DataSource, Delegate> Unpin for ListView<DataSource, Delegate>
where DataSource: Unpin, Delegate: Unpin,

§

impl<DataSource, Delegate> UnsafeUnpin for ListView<DataSource, Delegate>
where DataSource: UnsafeUnpin, Delegate: UnsafeUnpin,

§

impl<DataSource, Delegate> UnwindSafe for ListView<DataSource, Delegate>
where DataSource: UnwindSafe, Delegate: UnwindSafe,

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> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
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.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.