pub struct ThemePickerSource { /* private fields */ }Expand description
T.12a: :colorscheme (no arg) — the live-preview theme picker.
A trait-driven PickerSourceGenerator holding a clone of the
ThemeRegistryHandle so it can enumerate registered theme names
at init time. Arrowing through candidates LIVE-PREVIEWS each
theme (the host applies the
PickerPreviewOutcome::Colorscheme
the Self::preview hook returns); <Esc> restores the theme
active when the picker opened; <CR> keeps the highlighted theme.
Mode-owned-surface note: the host owns the theme subsystem (the
ThemeRegistry is a host ServiceRegistry service the renderers
read), so this source + its handler body both live host-side — no
half-migration.
Implementations§
Source§impl ThemePickerSource
impl ThemePickerSource
pub fn new(registry: Arc<dyn ThemeRegistry>) -> ThemePickerSource
Trait Implementations§
Source§impl PickerSourceGenerator for ThemePickerSource
impl PickerSourceGenerator for ThemePickerSource
Source§fn spec(&self) -> &PickerSourceSpec
fn spec(&self) -> &PickerSourceSpec
Generator metadata. Returned by reference so the
registry can stamp it into
:describe-picker /
:picker <Tab> listings without cloning.Source§fn init(
&self,
_ctx: &PickerContext<'_>,
_args: &[String],
) -> Result<PickerInitResult, String>
fn init( &self, _ctx: &PickerContext<'_>, _args: &[String], ) -> Result<PickerInitResult, String>
Build the candidate set. Sync prelude: read what’s
needed from
ctx, clone into async captures if
necessary, return the appropriate PickerInitResult
variant. Synchronous errors (no active buffer when
one was required, args validation failure) return
Err; the host echoes the error and leaves the
picker closed. Read moreSource§fn accept(
&self,
_ctx: &PickerContext<'_>,
routing: &RoutingPayload,
) -> Result<PickerAcceptOutcome, String>
fn accept( &self, _ctx: &PickerContext<'_>, routing: &RoutingPayload, ) -> Result<PickerAcceptOutcome, String>
Translate the user’s chosen routing payload into a
typed
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 preview(
&self,
_ctx: &PickerContext<'_>,
routing: &RoutingPayload,
) -> Option<PickerPreviewOutcome>
fn preview( &self, _ctx: &PickerContext<'_>, routing: &RoutingPayload, ) -> Option<PickerPreviewOutcome>
T.12: live-preview hook — invoked as the picker SELECTION moves to
a candidate (before accept). Default None = no preview. A source
returns an outcome the host applies immediately for a live preview;
the host restores prior state on . Read more
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>>>
Async-accept hook. Default
None means “this source resolves accept
synchronously” — every native source takes this path and is unchanged. Read moreSource§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>>
Live-source hook: re-fetch candidates when the user’s
query changes. Default
None means “static source –
host uses fuzzy refilter over the candidate set
returned by init”. Returning Some(result) from a
source whose spec().live == true replaces the
picker’s candidate set wholesale; the host wires up
debouncing and cancels any in-flight invocation when a
fresh query arrives. Read moreSource§fn descend(
&self,
_ctx: &PickerContext<'_>,
_candidate: &RawCandidate,
) -> Option<String>
fn descend( &self, _ctx: &PickerContext<'_>, _candidate: &RawCandidate, ) -> Option<String>
PC.10:
<C-l> — refine the query from the selected candidate instead
of accepting it. Read morePP.3:
<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>
PP.1: the query the picker opens WITH. Read more
Source§fn preview_debounce(&self) -> Option<Duration>
fn preview_debounce(&self) -> Option<Duration>
Auto Trait Implementations§
impl !RefUnwindSafe for ThemePickerSource
impl !UnwindSafe for ThemePickerSource
impl Freeze for ThemePickerSource
impl Send for ThemePickerSource
impl Sync for ThemePickerSource
impl Unpin for ThemePickerSource
impl UnsafeUnpin for ThemePickerSource
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
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&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> ⓘ
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§impl<T> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Converts this value into a three-state builder argument.
§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Converts this value into an optional builder argument.