pub struct PickerOptions { /* private fields */ }
Expand description
Specify configuration options for a Picker
.
Initialize with new
or (equivalently) the
Default
implementation, specify options, and then convert to a
Picker
using the picker
method.
§Example
use nucleo_picker::{render::StrRenderer, Picker, PickerOptions};
let picker: Picker<String, _> = PickerOptions::new()
.highlight(true)
.query("search")
.picker(StrRenderer);
Implementations§
Source§impl PickerOptions
impl PickerOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
Initialize with default configuration.
Equivalent to the Default
implementation.
Sourcepub fn picker<T: Send + Sync + 'static, R: Render<T>>(
self,
render: R,
) -> Picker<T, R>
pub fn picker<T: Send + Sync + 'static, R: Render<T>>( self, render: R, ) -> Picker<T, R>
Convert into a Picker
.
Sourcepub fn reversed(self, reversed: bool) -> Self
pub fn reversed(self, reversed: bool) -> Self
Set ‘reversed’ layout.
Option false
(default) will put the prompt at the bottom and render items in ascending
order. Option true
will put the prompt at the top and render items in descending order.
Sourcepub fn frame_interval(self, interval: Duration) -> Self
pub fn frame_interval(self, interval: Duration) -> Self
Set how long each frame should last.
This is the reciprocal of the refresh rate. The default value is
Duration::from_millis(15)
, which corresponds to a refresh rate of approximately 67 frames
per second. It is not recommended to set this to a value less than 8ms.
Sourcepub fn threads(self, threads: Option<NonZero<usize>>) -> Self
pub fn threads(self, threads: Option<NonZero<usize>>) -> Self
Set the number of threads used by the internal matching engine.
If None
(default), use a heuristic choice based on the amount of available
parallelism along with other factors.
Sourcepub fn config(self, config: Config) -> Self
pub fn config(self, config: Config) -> Self
Set the internal match engine configuration (default to nucleo::Config::DEFAULT
).
Sourcepub fn highlight(self, highlight: bool) -> Self
pub fn highlight(self, highlight: bool) -> Self
Whether or not to highlight matches (default to true
).
Sourcepub fn highlight_padding(self, size: u16) -> Self
pub fn highlight_padding(self, size: u16) -> Self
How much space to leave when rendering match highlighting (default to 3
).
Sourcepub fn scroll_padding(self, size: u16) -> Self
pub fn scroll_padding(self, size: u16) -> Self
How much space to leave around the selection when scrolling (default to 3
).
Sourcepub fn prompt_padding(self, size: u16) -> Self
pub fn prompt_padding(self, size: u16) -> Self
How much space to leave around the cursor (default to 2
).
Sourcepub fn case_matching(self, case_matching: CaseMatching) -> Self
pub fn case_matching(self, case_matching: CaseMatching) -> Self
How to treat case mismatch (default to CaseMatching::default
).
Sourcepub fn normalization(self, normalization: Normalization) -> Self
pub fn normalization(self, normalization: Normalization) -> Self
How to perform Unicode normalization (default to Normalization::default
).
Sourcepub fn query<Q: Into<String>>(self, query: Q) -> Self
pub fn query<Q: Into<String>>(self, query: Q) -> Self
Provide an initial query string for the prompt (default to ""
).
Sourcepub fn right_highlight_padding(self, size: u16) -> Self
👎Deprecated since 0.6.2: method has been renamed to highlight_padding
pub fn right_highlight_padding(self, size: u16) -> Self
highlight_padding
How much space to leave after rendering the rightmost highlight.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PickerOptions
impl RefUnwindSafe for PickerOptions
impl Send for PickerOptions
impl Sync for PickerOptions
impl Unpin for PickerOptions
impl UnwindSafe for PickerOptions
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> 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