style(core/rust/ui): rename Map to MsgMap

[no changelog]
pull/2901/head
Martin Milata 1 year ago
parent 08cad2f909
commit 2388a8edea

@ -5,7 +5,7 @@ use heapless::Vec;
use crate::{
time::Duration,
ui::{
component::{maybe::PaintOverlapping, Map},
component::{maybe::PaintOverlapping, MsgMap},
display::Color,
geometry::{Offset, Rect},
},
@ -314,7 +314,7 @@ where
}
pub trait ComponentExt: Sized {
fn map<F>(self, func: F) -> Map<Self, F>;
fn map<F>(self, func: F) -> MsgMap<Self, F>;
fn into_child(self) -> Child<Self>;
fn request_complete_repaint(&mut self, ctx: &mut EventCtx);
}
@ -323,8 +323,8 @@ impl<T> ComponentExt for T
where
T: Component,
{
fn map<F>(self, func: F) -> Map<Self, F> {
Map::new(self, func)
fn map<F>(self, func: F) -> MsgMap<Self, F> {
MsgMap::new(self, func)
}
fn into_child(self) -> Child<Self> {

@ -1,18 +1,18 @@
use super::{Component, Event, EventCtx};
use crate::ui::geometry::Rect;
pub struct Map<T, F> {
pub struct MsgMap<T, F> {
inner: T,
func: F,
}
impl<T, F> Map<T, F> {
impl<T, F> MsgMap<T, F> {
pub fn new(inner: T, func: F) -> Self {
Self { inner, func }
}
}
impl<T, F, U> Component for Map<T, F>
impl<T, F, U> Component for MsgMap<T, F>
where
T: Component,
F: Fn(T::Msg) -> Option<U>,
@ -38,7 +38,7 @@ where
}
#[cfg(feature = "ui_debug")]
impl<T, F> crate::trace::Trace for Map<T, F>
impl<T, F> crate::trace::Trace for MsgMap<T, F>
where
T: Component + crate::trace::Trace,
{

@ -20,7 +20,7 @@ pub use base::{Child, Component, ComponentExt, Event, EventCtx, Never, TimerToke
pub use border::Border;
pub use empty::Empty;
pub use label::Label;
pub use map::Map;
pub use map::MsgMap;
pub use marquee::Marquee;
pub use maybe::Maybe;
pub use pad::Pad;

@ -2,7 +2,7 @@ use crate::{
time::Duration,
ui::{
component::{
Component, ComponentExt, Event, EventCtx, FixedHeightBar, Map, Split, TimerToken,
Component, ComponentExt, Event, EventCtx, FixedHeightBar, MsgMap, Split, TimerToken,
},
display::{self, toif::Icon, Color, Font},
event::TouchEvent,
@ -509,10 +509,11 @@ pub enum CancelConfirmMsg {
Confirmed,
}
type CancelInfoConfirm<T, F0, F1, F2> =
FixedHeightBar<Split<Map<Button<T>, F0>, Split<Map<Button<T>, F1>, Map<Button<T>, F2>>>>;
type CancelInfoConfirm<T, F0, F1, F2> = FixedHeightBar<
Split<MsgMap<Button<T>, F0>, Split<MsgMap<Button<T>, F1>, MsgMap<Button<T>, F2>>>,
>;
type CancelConfirm<T, F0, F1> = FixedHeightBar<Split<Map<Button<T>, F0>, Map<Button<T>, F1>>>;
type CancelConfirm<T, F0, F1> = FixedHeightBar<Split<MsgMap<Button<T>, F0>, MsgMap<Button<T>, F1>>>;
#[derive(Clone, Copy)]
pub enum CancelInfoConfirmMsg {

Loading…
Cancel
Save