PickerOptions

Struct PickerOptions 

Source
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

Source

pub fn new() -> Self

Initialize with default configuration.

Equivalent to the Default implementation.

Source

pub fn picker<T: Send + Sync + 'static, R: Render<T>>( self, render: R, ) -> Picker<T, R>

Convert into a Picker.

Source

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.

Source

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.

Source

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.

Source

pub fn config(self, config: Config) -> Self

Set the internal match engine configuration (default to nucleo::Config::DEFAULT).

Source

pub fn highlight(self, highlight: bool) -> Self

Whether or not to highlight matches (default to true).

Source

pub fn highlight_padding(self, size: u16) -> Self

How much space to leave when rendering match highlighting (default to 3).

Source

pub fn scroll_padding(self, size: u16) -> Self

How much space to leave around the selection when scrolling (default to 3).

Source

pub fn prompt_padding(self, size: u16) -> Self

How much space to leave around the cursor (default to 2).

Source

pub fn case_matching(self, case_matching: CaseMatching) -> Self

How to treat case mismatch (default to CaseMatching::default).

Source

pub fn normalization(self, normalization: Normalization) -> Self

How to perform Unicode normalization (default to Normalization::default).

Source

pub fn query<Q: Into<String>>(self, query: Q) -> Self

Provide an initial query string for the prompt (default to "").

Source

pub fn right_highlight_padding(self, size: u16) -> Self

👎Deprecated since 0.6.2: method has been renamed to highlight_padding

How much space to leave after rendering the rightmost highlight.

Trait Implementations§

Source§

impl Default for PickerOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.