pub struct PermissionPanel { /* private fields */ }Expand description
State for the permission panel
Implementations§
Source§impl PermissionPanel
impl PermissionPanel
Sourcepub fn new() -> PermissionPanel
pub fn new() -> PermissionPanel
Create a new inactive permission panel
Sourcepub fn with_config(config: PermissionPanelConfig) -> PermissionPanel
pub fn with_config(config: PermissionPanelConfig) -> PermissionPanel
Create a new inactive permission panel with custom configuration
Sourcepub fn config(&self) -> &PermissionPanelConfig
pub fn config(&self) -> &PermissionPanelConfig
Get the current configuration
Sourcepub fn set_config(&mut self, config: PermissionPanelConfig)
pub fn set_config(&mut self, config: PermissionPanelConfig)
Set a new configuration
Sourcepub fn activate(
&mut self,
tool_use_id: String,
session_id: i64,
request: PermissionRequest,
turn_id: Option<TurnId>,
)
pub fn activate( &mut self, tool_use_id: String, session_id: i64, request: PermissionRequest, turn_id: Option<TurnId>, )
Activate the panel with a permission request
Sourcepub fn deactivate(&mut self)
pub fn deactivate(&mut self)
Deactivate the panel
Sourcepub fn tool_use_id(&self) -> &str
pub fn tool_use_id(&self) -> &str
Get the current tool use ID
Sourcepub fn session_id(&self) -> i64
pub fn session_id(&self) -> i64
Get the session ID
Sourcepub fn request(&self) -> &PermissionRequest
pub fn request(&self) -> &PermissionRequest
Get the current request
Sourcepub fn selected_option(&self) -> PermissionOption
pub fn selected_option(&self) -> PermissionOption
Get the currently selected option
Sourcepub fn select_next(&mut self)
pub fn select_next(&mut self)
Move selection to the next option
Sourcepub fn select_prev(&mut self)
pub fn select_prev(&mut self)
Move selection to the previous option
Sourcepub fn process_key(&mut self, key: KeyEvent) -> KeyAction
pub fn process_key(&mut self, key: KeyEvent) -> KeyAction
Handle a key event
Sourcepub fn panel_height(&self, max_height: u16) -> u16
pub fn panel_height(&self, max_height: u16) -> u16
Calculate the height needed for the panel
Sourcepub fn render_panel(&self, frame: &mut Frame<'_>, area: Rect, theme: &Theme)
pub fn render_panel(&self, frame: &mut Frame<'_>, area: Rect, theme: &Theme)
Render the panel
Trait Implementations§
Source§impl Default for PermissionPanel
impl Default for PermissionPanel
Source§fn default() -> PermissionPanel
fn default() -> PermissionPanel
Returns the “default value” for a type. Read more
Source§impl Widget for PermissionPanel
impl Widget for PermissionPanel
Source§fn handle_key(
&mut self,
key: KeyEvent,
ctx: &WidgetKeyContext<'_>,
) -> WidgetKeyResult
fn handle_key( &mut self, key: KeyEvent, ctx: &WidgetKeyContext<'_>, ) -> WidgetKeyResult
Handle key event, return result indicating what action to take. Read more
Source§fn required_height(&self, max_height: u16) -> u16
fn required_height(&self, max_height: u16) -> u16
Calculate required height for this widget Read more
Source§fn blocks_input(&self) -> bool
fn blocks_input(&self) -> bool
Whether this widget blocks input to the text input when active
Source§fn is_overlay(&self) -> bool
fn is_overlay(&self) -> bool
Whether this widget is a full-screen overlay Read more
Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Cast to Any for mutable downcasting
Auto Trait Implementations§
impl Freeze for PermissionPanel
impl RefUnwindSafe for PermissionPanel
impl Send for PermissionPanel
impl Sync for PermissionPanel
impl Unpin for PermissionPanel
impl UnwindSafe for PermissionPanel
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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