Skip to main content

tmux_interface/options/session/builder/local/
get_local_session_options.rs

1use crate::options::{GetLocalSessionOption, GetSessionOptionsTr, GetUserOptions};
2use crate::{TmuxCommand, TmuxCommands};
3
4#[derive(Debug)]
5pub struct GetLocalSessionOptions<'a> {
6    pub options: TmuxCommands<'a>,
7}
8
9impl<'a> GetUserOptions<'a> for GetLocalSessionOptions<'a> {
10    type Getter = GetLocalSessionOption;
11
12    fn push(&mut self, option: TmuxCommand<'a>) {
13        self.options.push(option);
14    }
15}
16
17// XXX: both are same, optimize
18impl<'a> GetSessionOptionsTr<'a, GetLocalSessionOption> for GetLocalSessionOptions<'a> {
19    fn new() -> Self
20    where
21        Self: Sized,
22    {
23        Self {
24            options: TmuxCommands::new(),
25        }
26    }
27
28    fn push<T: Into<TmuxCommand<'a>>>(&mut self, cmd: T) {
29        self.options.push(cmd.into())
30    }
31
32    fn into_commands(self) -> TmuxCommands<'a> {
33        self.options
34    }
35}