mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-29 06:20:28 +08:00
lib: Use associated types in views
This commit is contained in:
@@ -77,7 +77,10 @@ impl<'a, S, A> Header<'a, S, A> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a: 'static, S, A> View<S, A> for Header<'a, S, A> {
|
||||
impl<'a: 'static, S, A> View for Header<'a, S, A> {
|
||||
type Action = A;
|
||||
type State = S;
|
||||
|
||||
fn new(_state: &S, action_tx: UnboundedSender<A>) -> Self {
|
||||
Self {
|
||||
base: BaseView {
|
||||
@@ -108,7 +111,7 @@ impl<'a: 'static, S, A> View<S, A> for Header<'a, S, A> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a: 'static, B, S, A> Widget<B, S, A> for Header<'a, S, A>
|
||||
impl<'a: 'static, B, S, A> Widget<B> for Header<'a, S, A>
|
||||
where
|
||||
B: Backend,
|
||||
{
|
||||
@@ -234,7 +237,10 @@ impl<'a, S, A> Footer<'a, S, A> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a: 'static, S, A> View<S, A> for Footer<'a, S, A> {
|
||||
impl<'a: 'static, S, A> View for Footer<'a, S, A> {
|
||||
type Action = A;
|
||||
type State = S;
|
||||
|
||||
fn new(_state: &S, action_tx: UnboundedSender<A>) -> Self {
|
||||
Self {
|
||||
base: BaseView {
|
||||
@@ -289,7 +295,7 @@ impl<'a, S, A> Footer<'a, S, A> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a: 'static, B, S, A> Widget<B, S, A> for Footer<'a, S, A>
|
||||
impl<'a: 'static, B, S, A> Widget<B> for Footer<'a, S, A>
|
||||
where
|
||||
B: Backend,
|
||||
{
|
||||
@@ -386,10 +392,13 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<B, S, A> View<S, A> for Container<B, S, A>
|
||||
impl<B, S, A> View for Container<B, S, A>
|
||||
where
|
||||
B: Backend,
|
||||
{
|
||||
type Action = A;
|
||||
type State = S;
|
||||
|
||||
fn new(_state: &S, action_tx: UnboundedSender<A>) -> Self
|
||||
where
|
||||
Self: Sized,
|
||||
@@ -436,7 +445,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a: 'static, B, S, A> Widget<B, S, A> for Container<B, S, A>
|
||||
impl<'a: 'static, B, S, A> Widget<B> for Container<B, S, A>
|
||||
where
|
||||
B: Backend,
|
||||
{
|
||||
|
||||
@@ -126,7 +126,10 @@ impl<S, A> TextField<S, A> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<S, A> View<S, A> for TextField<S, A> {
|
||||
impl<S, A> View for TextField<S, A> {
|
||||
type Action = A;
|
||||
type State = S;
|
||||
|
||||
fn new(_state: &S, action_tx: UnboundedSender<A>) -> Self {
|
||||
Self {
|
||||
base: BaseView {
|
||||
@@ -186,7 +189,7 @@ impl<S, A> View<S, A> for TextField<S, A> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<B, S, A> Widget<B, S, A> for TextField<S, A>
|
||||
impl<B, S, A> Widget<B> for TextField<S, A>
|
||||
where
|
||||
B: Backend,
|
||||
{
|
||||
|
||||
@@ -142,7 +142,10 @@ impl<'a, S, A> Paragraph<'a, S, A> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a: 'static, S, A> View<S, A> for Paragraph<'a, S, A> {
|
||||
impl<'a: 'static, S, A> View for Paragraph<'a, S, A> {
|
||||
type Action = A;
|
||||
type State = S;
|
||||
|
||||
fn new(_state: &S, action_tx: UnboundedSender<A>) -> Self
|
||||
where
|
||||
Self: Sized,
|
||||
@@ -202,7 +205,7 @@ impl<'a: 'static, S, A> View<S, A> for Paragraph<'a, S, A> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a: 'static, B, S, A> Widget<B, S, A> for Paragraph<'a, S, A>
|
||||
impl<'a: 'static, B, S, A> Widget<B> for Paragraph<'a, S, A>
|
||||
where
|
||||
B: Backend,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user