mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-29 06:20:28 +08:00
bin: Use associated types in views
This commit is contained in:
@@ -210,7 +210,9 @@ pub enum Action {
|
||||
ScrollHelp { progress: usize },
|
||||
}
|
||||
|
||||
impl store::State<Action, Selection> for State {
|
||||
impl store::State<Selection> for State {
|
||||
type Action = Action;
|
||||
|
||||
fn tick(&self) {}
|
||||
|
||||
fn handle_action(&mut self, action: Action) -> Option<Exit<Selection>> {
|
||||
|
||||
@@ -119,10 +119,13 @@ pub struct BrowsePage<'a, B> {
|
||||
shortcuts: BoxedWidget<B>,
|
||||
}
|
||||
|
||||
impl<'a: 'static, B> View<State, Action> for BrowsePage<'a, B>
|
||||
impl<'a: 'static, B> View for BrowsePage<'a, B>
|
||||
where
|
||||
B: Backend + 'a,
|
||||
{
|
||||
type Action = Action;
|
||||
type State = State;
|
||||
|
||||
fn new(state: &State, action_tx: UnboundedSender<Action>) -> Self {
|
||||
let props = BrowsePageProps::from(state);
|
||||
let name = match state.mode.repository() {
|
||||
@@ -327,7 +330,7 @@ impl<'a, B: Backend> BrowsePage<'a, B> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a: 'static, B> Widget<B, State, Action> for BrowsePage<'a, B>
|
||||
impl<'a: 'static, B> Widget<B> for BrowsePage<'a, B>
|
||||
where
|
||||
B: Backend + 'a,
|
||||
{
|
||||
@@ -396,7 +399,10 @@ pub struct Search<B: Backend> {
|
||||
input: BoxedWidget<B>,
|
||||
}
|
||||
|
||||
impl<B: Backend> View<State, Action> for Search<B> {
|
||||
impl<B: Backend> View for Search<B> {
|
||||
type Action = Action;
|
||||
type State = State;
|
||||
|
||||
fn new(state: &State, action_tx: UnboundedSender<Action>) -> Self
|
||||
where
|
||||
Self: Sized,
|
||||
@@ -453,7 +459,7 @@ impl<B: Backend> View<State, Action> for Search<B> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<B> Widget<B, State, Action> for Search<B>
|
||||
impl<B> Widget<B> for Search<B>
|
||||
where
|
||||
B: Backend,
|
||||
{
|
||||
@@ -501,10 +507,13 @@ where
|
||||
shortcuts: BoxedWidget<B>,
|
||||
}
|
||||
|
||||
impl<'a: 'static, B> View<State, Action> for HelpPage<'a, B>
|
||||
impl<'a: 'static, B> View for HelpPage<'a, B>
|
||||
where
|
||||
B: Backend + 'a,
|
||||
{
|
||||
type Action = Action;
|
||||
type State = State;
|
||||
|
||||
fn new(state: &State, action_tx: UnboundedSender<Action>) -> Self
|
||||
where
|
||||
Self: Sized,
|
||||
@@ -604,7 +613,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a: 'static, B> Widget<B, State, Action> for HelpPage<'a, B>
|
||||
impl<'a: 'static, B> Widget<B> for HelpPage<'a, B>
|
||||
where
|
||||
B: Backend + 'a,
|
||||
{
|
||||
|
||||
@@ -129,8 +129,8 @@ pub enum Action {
|
||||
ScrollHelp { progress: usize },
|
||||
}
|
||||
|
||||
impl store::State<Action, Selection> for State {
|
||||
fn tick(&self) {}
|
||||
impl store::State<Selection> for State {
|
||||
type Action = Action;
|
||||
|
||||
fn handle_action(&mut self, action: Action) -> Option<Exit<Selection>> {
|
||||
match action {
|
||||
@@ -185,6 +185,8 @@ impl store::State<Action, Selection> for State {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn tick(&self) {}
|
||||
}
|
||||
|
||||
impl App {
|
||||
|
||||
@@ -133,10 +133,13 @@ pub struct BrowsePage<'a, B> {
|
||||
shortcuts: BoxedWidget<B>,
|
||||
}
|
||||
|
||||
impl<'a: 'static, B> View<State, Action> for BrowsePage<'a, B>
|
||||
impl<'a: 'static, B> View for BrowsePage<'a, B>
|
||||
where
|
||||
B: Backend + 'a,
|
||||
{
|
||||
type Action = Action;
|
||||
type State = State;
|
||||
|
||||
fn new(state: &State, action_tx: UnboundedSender<Action>) -> Self {
|
||||
let props = BrowsePageProps::from(state);
|
||||
|
||||
@@ -346,7 +349,7 @@ impl<'a, B: Backend> BrowsePage<'a, B> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a: 'static, B> Widget<B, State, Action> for BrowsePage<'a, B>
|
||||
impl<'a: 'static, B> Widget<B> for BrowsePage<'a, B>
|
||||
where
|
||||
B: Backend + 'a,
|
||||
{
|
||||
@@ -415,7 +418,10 @@ pub struct Search<B: Backend> {
|
||||
input: BoxedWidget<B>,
|
||||
}
|
||||
|
||||
impl<B: Backend> View<State, Action> for Search<B> {
|
||||
impl<B: Backend> View for Search<B> {
|
||||
type Action = Action;
|
||||
type State = State;
|
||||
|
||||
fn new(state: &State, action_tx: UnboundedSender<Action>) -> Self
|
||||
where
|
||||
Self: Sized,
|
||||
@@ -472,7 +478,7 @@ impl<B: Backend> View<State, Action> for Search<B> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<B> Widget<B, State, Action> for Search<B>
|
||||
impl<B> Widget<B> for Search<B>
|
||||
where
|
||||
B: Backend,
|
||||
{
|
||||
@@ -520,10 +526,13 @@ where
|
||||
shortcuts: BoxedWidget<B>,
|
||||
}
|
||||
|
||||
impl<'a: 'static, B> View<State, Action> for HelpPage<'a, B>
|
||||
impl<'a: 'static, B> View for HelpPage<'a, B>
|
||||
where
|
||||
B: Backend + 'a,
|
||||
{
|
||||
type Action = Action;
|
||||
type State = State;
|
||||
|
||||
fn new(state: &State, action_tx: UnboundedSender<Action>) -> Self
|
||||
where
|
||||
Self: Sized,
|
||||
@@ -623,7 +632,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a: 'static, B> Widget<B, State, Action> for HelpPage<'a, B>
|
||||
impl<'a: 'static, B> Widget<B> for HelpPage<'a, B>
|
||||
where
|
||||
B: Backend + 'a,
|
||||
{
|
||||
|
||||
@@ -134,8 +134,8 @@ pub enum Action {
|
||||
ScrollHelp { progress: usize },
|
||||
}
|
||||
|
||||
impl store::State<Action, Selection> for State {
|
||||
fn tick(&self) {}
|
||||
impl store::State<Selection> for State {
|
||||
type Action = Action;
|
||||
|
||||
fn handle_action(&mut self, action: Action) -> Option<Exit<Selection>> {
|
||||
match action {
|
||||
@@ -190,6 +190,8 @@ impl store::State<Action, Selection> for State {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn tick(&self) {}
|
||||
}
|
||||
|
||||
impl App {
|
||||
|
||||
@@ -134,10 +134,13 @@ pub struct BrowsePage<'a, B> {
|
||||
shortcuts: BoxedWidget<B>,
|
||||
}
|
||||
|
||||
impl<'a: 'static, B> View<State, Action> for BrowsePage<'a, B>
|
||||
impl<'a: 'static, B> View for BrowsePage<'a, B>
|
||||
where
|
||||
B: Backend + 'a,
|
||||
{
|
||||
type Action = Action;
|
||||
type State = State;
|
||||
|
||||
fn new(state: &State, action_tx: UnboundedSender<Action>) -> Self {
|
||||
let props = BrowsePageProps::from(state);
|
||||
|
||||
@@ -374,7 +377,7 @@ impl<'a, B: Backend> BrowsePage<'a, B> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a: 'static, B> Widget<B, State, Action> for BrowsePage<'a, B>
|
||||
impl<'a: 'static, B> Widget<B> for BrowsePage<'a, B>
|
||||
where
|
||||
B: Backend + 'a,
|
||||
{
|
||||
@@ -443,7 +446,10 @@ pub struct Search<B: Backend> {
|
||||
input: BoxedWidget<B>,
|
||||
}
|
||||
|
||||
impl<B: Backend> View<State, Action> for Search<B> {
|
||||
impl<B: Backend> View for Search<B> {
|
||||
type Action = Action;
|
||||
type State = State;
|
||||
|
||||
fn new(state: &State, action_tx: UnboundedSender<Action>) -> Self
|
||||
where
|
||||
Self: Sized,
|
||||
@@ -500,7 +506,7 @@ impl<B: Backend> View<State, Action> for Search<B> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<B> Widget<B, State, Action> for Search<B>
|
||||
impl<B> Widget<B> for Search<B>
|
||||
where
|
||||
B: Backend,
|
||||
{
|
||||
@@ -548,10 +554,13 @@ where
|
||||
shortcuts: BoxedWidget<B>,
|
||||
}
|
||||
|
||||
impl<'a: 'static, B> View<State, Action> for HelpPage<'a, B>
|
||||
impl<'a: 'static, B> View for HelpPage<'a, B>
|
||||
where
|
||||
B: Backend + 'a,
|
||||
{
|
||||
type Action = Action;
|
||||
type State = State;
|
||||
|
||||
fn new(state: &State, action_tx: UnboundedSender<Action>) -> Self
|
||||
where
|
||||
Self: Sized,
|
||||
@@ -651,7 +660,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a: 'static, B> Widget<B, State, Action> for HelpPage<'a, B>
|
||||
impl<'a: 'static, B> Widget<B> for HelpPage<'a, B>
|
||||
where
|
||||
B: Backend + 'a,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user