pub struct LogMode {
input_history: Vec<String>,
history_index: Option<usize>,
}Expand description
Manages the state and logic for the log input and display.
Fields§
§input_history: Vec<String>History of user input commands within the log mode.
history_index: Option<usize>Current index in the input history for navigation.
Implementations§
Source§impl LogMode
impl LogMode
Sourcepub(crate) async fn execute_log_command(
&self,
input: &str,
state: &mut UIState,
) -> Result<()>
pub(crate) async fn execute_log_command( &self, input: &str, state: &mut UIState, ) -> Result<()>
Executes a command entered by the user in log mode.
This function parses the input string and dispatches various log-related commands, such as setting the log level, filtering logs, clearing the buffer, or displaying a tail of the logs.
§Arguments
input- The command string entered by the user.state- The current UI state, which will be modified based on the command.
§Errors
This function returns an error if command execution fails due to unexpected issues.
Source§impl LogMode
impl LogMode
Navigates through the input history in log mode.
§Arguments
state- The current UI state, which holds the input buffer.up- Iftrue, navigates to an older history entry; iffalse, navigates to a newer entry.
Source§impl LogMode
impl LogMode
Sourcepub async fn handle_key(
&mut self,
state: &mut UIState,
key: KeyEvent,
_action_tx: &UnboundedSender<UIAction>,
) -> Result<()>
pub async fn handle_key( &mut self, state: &mut UIState, key: KeyEvent, _action_tx: &UnboundedSender<UIAction>, ) -> Result<()>
Handles a key event in log mode.
This function processes various key presses, including typing characters, navigating input history, moving the cursor, and scrolling through logs.
§Arguments
state- The current UI state.key- TheKeyEventto handle._action_tx- The sender for dispatching UI actions (unused in log mode input).
§Errors
This function returns an error if a command execution fails.
Source§impl LogMode
impl LogMode
Sourcepub fn render(
&self,
stdout: &mut impl Write,
state: &UIState,
area: (u16, u16, u16, u16),
) -> Result<()>
pub fn render( &self, stdout: &mut impl Write, state: &UIState, area: (u16, u16, u16, u16), ) -> Result<()>
Renders the log view to the terminal.
This function displays filtered log entries, handling scrolling and applying color coding based on log levels.
§Arguments
stdout- A mutable reference to the output stream.state- The current UI state, containing log entries and scroll offsets.area- The (x, y, width, height) coordinates of the rendering area.
§Errors
This function returns an error if writing to the output stream fails.
Auto Trait Implementations§
impl Freeze for LogMode
impl RefUnwindSafe for LogMode
impl Send for LogMode
impl Sync for LogMode
impl Unpin for LogMode
impl UnwindSafe for LogMode
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<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