pub struct ApprovalQueue<T> { /* private fields */ }Expand description
A queue of pending items to approve, reject or skip. Returns an
ApprovalReport.
Implementations§
Source§impl<T> ApprovalQueue<T>
impl<T> ApprovalQueue<T>
pub fn new<I, V>(prompt: impl Into<String>, items: I) -> ApprovalQueue<T>
Sourcepub fn preview(self, layout: PreviewLayout) -> Self
pub fn preview(self, layout: PreviewLayout) -> Self
Where the detail pane goes (default: beside the list from 72
columns, below it when narrower); Hidden hides it.
Sourcepub fn preview_height(self, rows: usize) -> Self
pub fn preview_height(self, rows: usize) -> Self
Rows the detail pane takes when it is below the list (default 8).
pub fn theme(self, theme: Theme) -> Self
Sourcepub fn with_mouse(self, on: bool) -> Self
pub fn with_mouse(self, on: bool) -> Self
Report the mouse (#476): rows, the mark column and the buttons click, and the wheel moves.
Sourcepub fn rebind(self, action: &str, keys: impl IntoIterator<Item = Key>) -> Self
pub fn rebind(self, action: &str, keys: impl IntoIterator<Item = Key>) -> Self
Make keys do action (see approve_keymap) on this queue
only; no keys unbinds it.
Sourcepub fn require_reason(self, verdict: Verdict) -> Self
pub fn require_reason(self, verdict: Verdict) -> Self
Ask for a reason whenever an item gets verdict (a rejection, say),
and refuse an empty one.
Sourcepub fn advance(self, on: bool) -> Self
pub fn advance(self, on: bool) -> Self
Whether a decision moves the cursor on to the next pending item (default on).
Sourcepub fn auto_submit(self, on: bool) -> Self
pub fn auto_submit(self, on: bool) -> Self
Submit by itself as soon as nothing is pending (default off: Enter submits).
Sourcepub fn decided(
self,
index: usize,
verdict: Verdict,
reason: Option<String>,
) -> Self
pub fn decided( self, index: usize, verdict: Verdict, reason: Option<String>, ) -> Self
Start item index decided: a review picked up where it was left.
pub fn items(&self) -> &[Item<T>]
Sourcepub fn focused(&self) -> Option<usize>
pub fn focused(&self) -> Option<usize>
The focused item’s index (none when the queue is empty).
Sourcepub fn is_asking_reason(&self) -> bool
pub fn is_asking_reason(&self) -> bool
Whether a reason is being typed.
Sourcepub fn approve_keymap(&self) -> &Keymap
pub fn approve_keymap(&self) -> &Keymap
The keys, with any rebinding.
Source§impl<T: Clone> ApprovalQueue<T>
impl<T: Clone> ApprovalQueue<T>
Sourcepub fn report(&self) -> ApprovalReport<T>
pub fn report(&self) -> ApprovalReport<T>
The report as things stand: every item with its decision so far.
Trait Implementations§
Source§impl<T: Clone> Component for ApprovalQueue<T>
impl<T: Clone> Component for ApprovalQueue<T>
Source§fn default_value(&self) -> Option<ApprovalReport<T>>
fn default_value(&self) -> Option<ApprovalReport<T>>
The decisions as they stand: without a terminal and asked for defaults, nothing is decided.
type Output = ApprovalReport<T>
Source§fn handle(
&mut self,
event: &Event,
context: &Context<'_>,
) -> Flow<ApprovalReport<T>>
fn handle( &mut self, event: &Event, context: &Context<'_>, ) -> Flow<ApprovalReport<T>>
Outcome::Interrupted.Source§fn mouse(&self) -> bool
fn mouse(&self) -> bool
run then enables mouse reporting
for the session.Source§fn keymap(&self) -> Keymap
fn keymap(&self) -> Keymap
keymap). A container’s include its focused
child’s, before its own. The default declares none.Source§fn prompt(
&mut self,
io: &mut dyn LineIo,
) -> Result<Option<ApprovalReport<T>>, NotInteractive>
fn prompt( &mut self, io: &mut dyn LineIo, ) -> Result<Option<ApprovalReport<T>>, NotInteractive>
Source§fn start(&mut self, context: &Context<'_>) -> Flow<Self::Output>
fn start(&mut self, context: &Context<'_>) -> Flow<Self::Output>
Done or Cancel finishes the component
without waiting for an event. The default does nothing.Source§fn tick(&self) -> Option<Duration>
fn tick(&self) -> Option<Duration>
Event::Tick, for a spinner or a
countdown. None (the default): never.Source§fn focusable(&self) -> bool
fn focusable(&self) -> bool
Source§fn focus_step(&mut self, forward: bool) -> bool
fn focus_step(&mut self, forward: bool) -> bool
forward) or previous focus stop inside
this component, for Tab and Shift+Tab. false when there is none
after the current one, so the container moves on to its next
child. The default, for a component that is one stop: false.Auto Trait Implementations§
impl<T> !Freeze for ApprovalQueue<T>
impl<T> !RefUnwindSafe for ApprovalQueue<T>
impl<T> !Sync for ApprovalQueue<T>
impl<T> !UnwindSafe for ApprovalQueue<T>
impl<T> Send for ApprovalQueue<T>
impl<T> Unpin for ApprovalQueue<T>
impl<T> UnsafeUnpin for ApprovalQueue<T>
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<C> ComponentExt for Cwhere
C: Component,
impl<C> ComponentExt for Cwhere
C: Component,
Source§fn map<'a, M>(
self,
done: impl FnMut(Self::Output) -> Flow<M> + 'a,
) -> Map<'a, Self, M>where
Self: 'a,
fn map<'a, M>(
self,
done: impl FnMut(Self::Output) -> Flow<M> + 'a,
) -> Map<'a, Self, M>where
Self: 'a,
M’s flow: Flow::Done(m) to
finish the whole composition with m, Flow::Continue to carry on
(the component stays, showing its answer, and focus moves past it).
Cancelling cancels the composition unless
on_cancel says otherwise.