pub struct PickerRequest {
pub title: String,
pub items: Vec<PickerItem>,
pub dispatch_command: String,
}Expand description
A complete engine-supplied picker: what to show, and what selecting an item does.
Why: tagent hardcodes two picker kinds (PickerKind::Model,
PickerKind::Provider, crates/trusty-agents/src/repl/tui/types.rs:28-35)
with Enter-dispatch bound to the literal strings "/model" /
"/provider" — the shared crate must not know either of those concepts
exist. PickerRequest generalizes this: the engine names the picker
(title), supplies the rows (items), and supplies the command prefix
to dispatch on selection (dispatch_command) — the shared event loop
(Slice 4/7) confirms a selection by emitting
ReplEvent::Submit(format!("{} {}", dispatch_command, selected.id)),
reproducing tagent’s exact /model <selected> / /provider <selected>
behavior without the shared crate hardcoding either command name.
What: title renders in the picker’s border/header; items is the
(already-fetched) list of choices — no lazy paging in this slice.
TuiEngine::picker (see crate::engine) is how the shared event loop
asks an engine for one of these by name.
Fields§
§title: String§items: Vec<PickerItem>§dispatch_command: StringTrait Implementations§
Source§impl Clone for PickerRequest
impl Clone for PickerRequest
Source§impl Debug for PickerRequest
impl Debug for PickerRequest
Source§impl<'de> Deserialize<'de> for PickerRequest
impl<'de> Deserialize<'de> for PickerRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for PickerRequest
Source§impl PartialEq for PickerRequest
impl PartialEq for PickerRequest
Source§impl Serialize for PickerRequest
impl Serialize for PickerRequest
impl StructuralPartialEq for PickerRequest
Auto Trait Implementations§
impl Forget for PickerRequest
impl Freeze for PickerRequest
impl Move for PickerRequest
impl RefUnwindSafe for PickerRequest
impl Send for PickerRequest
impl Sync for PickerRequest
impl Unpin for PickerRequest
impl UnsafeUnpin for PickerRequest
impl UnwindSafe for PickerRequest
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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