pub struct GrepSource {
pub spec: PickerSourceSpec,
pub config: Arc<ConfigRegistry>,
pub highlighter: Option<Arc<dyn GrepPreviewHighlighter>>,
}Fields§
§spec: PickerSourceSpec§config: Arc<ConfigRegistry>§highlighter: Option<Arc<dyn GrepPreviewHighlighter>>PH.3: optional preview highlighter, captured at
construction like config. None ⇒ plain previews
(e.g. tests, or a host that doesn’t wire syntax).
Implementations§
Source§impl GrepSource
impl GrepSource
pub fn new( config: Arc<ConfigRegistry>, highlighter: Option<Arc<dyn GrepPreviewHighlighter>>, ) -> GrepSource
Trait Implementations§
Source§impl PickerSourceGenerator for GrepSource
impl PickerSourceGenerator for GrepSource
Source§fn init(
&self,
ctx: &PickerContext<'_>,
args: &[String],
) -> Result<PickerInitResult, String>
fn init( &self, ctx: &PickerContext<'_>, args: &[String], ) -> Result<PickerInitResult, String>
Slice 3: optional initial pattern. With no pattern the
picker opens empty (no grep runs); the first keystroke
triggers the live flow through on_query_changed.
With an initial pattern the grep runs immediately –
async via the Future variant so the UI thread doesn’t
park on the first invocation either. The host seeds
picker.query with the initial pattern (live-source
convention in App::open_picker), so subsequent
keystrokes extend the same query.
Source§fn on_query_changed(
&self,
ctx: &PickerContext<'_>,
query: &str,
) -> Option<Result<PickerInitResult, String>>
fn on_query_changed( &self, ctx: &PickerContext<'_>, query: &str, ) -> Option<Result<PickerInitResult, String>>
Slice 3: live re-execution. The host’s
drain_pending_live_picker_query calls this every time
the debounce expires; we trim, special-case the empty
query (no grep, empty result – clears the candidate
list), and otherwise spawn the grep on the blocking
pool. The Future variant lets the host cancel us if a
newer keystroke fires before we finish.
Source§fn spec(&self) -> &PickerSourceSpec
fn spec(&self) -> &PickerSourceSpec
:describe-picker /
:picker <Tab> listings without cloning.Source§fn accept(
&self,
_ctx: &PickerContext<'_>,
routing: &RoutingPayload,
) -> Result<PickerAcceptOutcome, String>
fn accept( &self, _ctx: &PickerContext<'_>, routing: &RoutingPayload, ) -> Result<PickerAcceptOutcome, String>
PickerAcceptOutcome the host applies. The
generator owns the mapping from its emitted
routing-payload variant(s) to outcome(s); mismatch
returns Err, which the host echoes.Source§fn accept_async(
&self,
_ctx: &PickerContext<'_>,
_routing: &RoutingPayload,
) -> Option<Pin<Box<dyn Future<Output = Result<PickerAcceptOutcome, String>> + Send>>>
fn accept_async( &self, _ctx: &PickerContext<'_>, _routing: &RoutingPayload, ) -> Option<Pin<Box<dyn Future<Output = Result<PickerAcceptOutcome, String>> + Send>>>
None means “this source resolves accept
synchronously” — every native source takes this path and is unchanged. Read moreSource§fn descend(
&self,
_ctx: &PickerContext<'_>,
_candidate: &RawCandidate,
) -> Option<String>
fn descend( &self, _ctx: &PickerContext<'_>, _candidate: &RawCandidate, ) -> Option<String>
<C-l> — refine the query from the selected candidate instead
of accepting it. Read more<CR> on a row that is a SIGNPOST rather than a destination. Read moreSource§fn initial_query(&self, _args: &[String]) -> Option<String>
fn initial_query(&self, _args: &[String]) -> Option<String>
Source§fn preview(
&self,
_ctx: &PickerContext<'_>,
_routing: &RoutingPayload,
) -> Option<PickerPreviewOutcome>
fn preview( &self, _ctx: &PickerContext<'_>, _routing: &RoutingPayload, ) -> Option<PickerPreviewOutcome>
Source§fn preview_debounce(&self) -> Option<Duration>
fn preview_debounce(&self) -> Option<Duration>
Auto Trait Implementations§
impl !RefUnwindSafe for GrepSource
impl !UnwindSafe for GrepSource
impl Freeze for GrepSource
impl Send for GrepSource
impl Sync for GrepSource
impl Unpin for GrepSource
impl UnsafeUnpin for GrepSource
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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