remove PhrasesControl trait

This commit is contained in:
🪞👃🪞 2024-11-26 17:46:14 +01:00
parent d1fdc7f8b6
commit 4fdc3911e4
10 changed files with 64 additions and 68 deletions

View file

@ -11,8 +11,8 @@ pub enum FileBrowserCommand {
Filter(String),
}
impl<T: PhrasesControl> Command<T> for FileBrowserCommand {
fn execute (self, state: &mut T) -> Perhaps<Self> {
impl Command<PhraseListModel> for FileBrowserCommand {
fn execute (self, state: &mut PhraseListModel) -> Perhaps<Self> {
use FileBrowserCommand::*;
use PhrasesMode::{Import, Export};
let mode = state.phrases_mode_mut();
@ -58,8 +58,8 @@ impl<T: PhrasesControl> Command<T> for FileBrowserCommand {
}
}
impl<T: PhrasesControl> InputToCommand<Tui, T> for FileBrowserCommand {
fn input_to_command (state: &T, from: &TuiInput) -> Option<Self> {
impl InputToCommand<Tui, PhraseListModel> for FileBrowserCommand {
fn input_to_command (state: &PhraseListModel, from: &TuiInput) -> Option<Self> {
use KeyCode::{Up, Down, Right, Left, Enter, Esc, Char, Backspace};
use FileBrowserCommand::*;
if let Some(PhrasesMode::Import(index, browser)) = state.phrases_mode() {
@ -96,8 +96,8 @@ impl<T: PhrasesControl> InputToCommand<Tui, T> for FileBrowserCommand {
}
}
impl<T: PhrasesControl> InputToCommand<Tui, T> for PhraseLengthCommand {
fn input_to_command (state: &T, from: &TuiInput) -> Option<Self> {
impl InputToCommand<Tui, PhraseListModel> for PhraseLengthCommand {
fn input_to_command (state: &PhraseListModel, from: &TuiInput) -> Option<Self> {
use KeyCode::{Up, Down, Right, Left, Enter, Esc};
if let Some(PhrasesMode::Length(_, length, _)) = state.phrases_mode() {
Some(match from.event() {