pub struct State {Show 14 fields
pub repo: Rc<Repository>,
pub config: Rc<Config>,
pub bindings: Bindings,
pub pending_keys: Vec<(KeyModifiers, KeyCode)>,
pub quit: bool,
pub screens: Vec<Screen>,
pub pending_menu: Option<PendingMenu>,
pub pending_cmd: Option<(Child, Arc<RwLock<CmdLogEntry>>)>,
pub enable_async_cmds: bool,
pub current_cmd_log: CmdLog,
pub prompt: Prompt,
pub clipboard: Option<Clipboard>,
pub needs_redraw: bool,
pub file_watcher: Option<FileWatcher>,
}Expand description
The main application state, holding all the necessary data for the UI and Git operations.
Fields§
§repo: Rc<Repository>The Git repository being managed.
config: Rc<Config>Application configuration settings.
bindings: BindingsKey bindings for various actions.
pending_keys: Vec<(KeyModifiers, KeyCode)>Keys that have been pressed but not yet matched to a binding.
quit: boolFlag to indicate if the application should quit.
screens: Vec<Screen>A stack of currently active screens in the UI.
The currently pending menu, if any.
pending_cmd: Option<(Child, Arc<RwLock<CmdLogEntry>>)>A command that is currently running asynchronously.
enable_async_cmds: boolFlag to enable or disable asynchronous command execution.
current_cmd_log: CmdLogLog of commands executed.
prompt: PromptThe prompt used for user input.
clipboard: Option<Clipboard>The system clipboard, if available.
needs_redraw: boolFlag to indicate if the UI needs to be redrawn.
file_watcher: Option<FileWatcher>Watches for file system changes to trigger UI updates.
Implementations§
Source§impl State
impl State
pub fn create( repo: Rc<Repository>, size: Size, args: &Args, config: Rc<Config>, enable_async_cmds: bool, ) -> Res<Self>
pub fn run(&mut self, term: &mut Term, max_tick_delay: Duration) -> Res<()>
pub fn update(&mut self, term: &mut Term) -> Res<()>
pub fn handle_event(&mut self, term: &mut Term, event: Event) -> Res<()>
pub fn redraw_now(&mut self, term: &mut Term) -> Res<()>
pub fn stage_redraw(&mut self)
pub fn screen_mut(&mut self) -> &mut Screen
pub fn screen(&self) -> &Screen
Sourcepub fn display_info<S: Into<Cow<'static, str>>>(&mut self, message: S)
pub fn display_info<S: Into<Cow<'static, str>>>(&mut self, message: S)
Displays an Info message to the CmdLog.
Sourcepub fn display_error<S: Into<Cow<'static, str>>>(&mut self, message: S)
pub fn display_error<S: Into<Cow<'static, str>>>(&mut self, message: S)
Displays an Error message to the CmdLog.
Sourcepub fn run_cmd(
&mut self,
term: &mut Term,
input: &[u8],
cmd: Command,
) -> Res<()>
pub fn run_cmd( &mut self, term: &mut Term, input: &[u8], cmd: Command, ) -> Res<()>
Runs a Command and handles its output.
Will block awaiting its completion.
Sourcepub fn run_cmd_async(
&mut self,
term: &mut Term,
input: &[u8],
cmd: Command,
) -> Res<()>
pub fn run_cmd_async( &mut self, term: &mut Term, input: &[u8], cmd: Command, ) -> Res<()>
Runs a Command and handles its output asynchronously (if async commands are enabled).
Will return Ok(()) if one is already running.
pub fn run_cmd_interactive(&mut self, term: &mut Term, cmd: Command) -> Res<()>
pub fn selected_rev(&self) -> Option<String>
pub fn prompt(&mut self, term: &mut Term, params: &PromptParams) -> Res<String>
pub fn confirm(&mut self, term: &mut Term, prompt: &'static str) -> Res<()>
Auto Trait Implementations§
impl Freeze for State
impl !RefUnwindSafe for State
impl !Send for State
impl !Sync for State
impl Unpin for State
impl !UnwindSafe for State
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
Source§fn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
Source§fn cast_approx(self) -> T
fn cast_approx(self) -> T
Source§impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
Source§fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
Source§fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
Source§fn cast_floor(self) -> T
fn cast_floor(self) -> T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more