Struct FzfBuilder

Source
pub struct FzfBuilder { /* private fields */ }
Expand description

Builder for Fzf.

Implementations§

Source§

impl FzfBuilder

Source

pub fn scheme<VALUE: Into<Scheme>>(&mut self, value: VALUE) -> &mut Self

Scoring scheme

Source

pub fn literal<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

Do not normalize latin script letters before matching

Source

pub fn track<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

Track the current selection when the result is updated

Source

pub fn tac<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

Reverse the order of the input

Source

pub fn disabled<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

Do not perform search

Source

pub fn no_mouse<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

Disable mouse

Source

pub fn cycle<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

Enable cyclic scroll

Source

pub fn keep_right<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

Keep the right end of the line visible on overflow

Source

pub fn no_hscroll<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

Disable horizontal scroll

Source

pub fn filepath_word<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

Make word-wise movements respect path separators

Source

pub fn layout<VALUE: Into<Layout>>(&mut self, value: VALUE) -> &mut Self

Choose layout

Examples found in repository?
examples/color.rs (line 11)
5fn main() {
6    let colours = vec![
7        "red", "orange", "yellow", "green", "blue", "indigo", "violet",
8    ];
9
10    let fzf = Fzf::builder()
11        .layout(Layout::Reverse)
12        .border(Border::Rounded)
13        .border_label("Favourite Colour")
14        .color(Color::Bw)
15        .header("Pick your favourite colour")
16        .header_first(true)
17        .custom_args(vec!["--height=10".to_string()])
18        .build()
19        .unwrap();
20
21    let users_selection = run_with_output(fzf, colours);
22
23    if let Some(colour) = users_selection {
24        println!("{} is an awesome colour!", colour);
25    }
26}
Source

pub fn border<VALUE: Into<Border>>(&mut self, value: VALUE) -> &mut Self

Draw border around the finder

Examples found in repository?
examples/color.rs (line 12)
5fn main() {
6    let colours = vec![
7        "red", "orange", "yellow", "green", "blue", "indigo", "violet",
8    ];
9
10    let fzf = Fzf::builder()
11        .layout(Layout::Reverse)
12        .border(Border::Rounded)
13        .border_label("Favourite Colour")
14        .color(Color::Bw)
15        .header("Pick your favourite colour")
16        .header_first(true)
17        .custom_args(vec!["--height=10".to_string()])
18        .build()
19        .unwrap();
20
21    let users_selection = run_with_output(fzf, colours);
22
23    if let Some(colour) = users_selection {
24        println!("{} is an awesome colour!", colour);
25    }
26}
Source

pub fn border_label<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self

Label to print on the border

Examples found in repository?
examples/color.rs (line 13)
5fn main() {
6    let colours = vec![
7        "red", "orange", "yellow", "green", "blue", "indigo", "violet",
8    ];
9
10    let fzf = Fzf::builder()
11        .layout(Layout::Reverse)
12        .border(Border::Rounded)
13        .border_label("Favourite Colour")
14        .color(Color::Bw)
15        .header("Pick your favourite colour")
16        .header_first(true)
17        .custom_args(vec!["--height=10".to_string()])
18        .build()
19        .unwrap();
20
21    let users_selection = run_with_output(fzf, colours);
22
23    if let Some(colour) = users_selection {
24        println!("{} is an awesome colour!", colour);
25    }
26}
Source

pub fn no_separator<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

Hide info line separator

Source

pub fn no_scrollbar<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

Hide scrollbar

Source

pub fn prompt<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self

Input prompt (default: ’> ’)

Source

pub fn pointer<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self

Pointer to the current line (default: ‘>’)

Source

pub fn header<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self

String to print as header

Examples found in repository?
examples/color.rs (line 15)
5fn main() {
6    let colours = vec![
7        "red", "orange", "yellow", "green", "blue", "indigo", "violet",
8    ];
9
10    let fzf = Fzf::builder()
11        .layout(Layout::Reverse)
12        .border(Border::Rounded)
13        .border_label("Favourite Colour")
14        .color(Color::Bw)
15        .header("Pick your favourite colour")
16        .header_first(true)
17        .custom_args(vec!["--height=10".to_string()])
18        .build()
19        .unwrap();
20
21    let users_selection = run_with_output(fzf, colours);
22
23    if let Some(colour) = users_selection {
24        println!("{} is an awesome colour!", colour);
25    }
26}
Source

pub fn header_first<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

Print header before the prompt line

Examples found in repository?
examples/color.rs (line 16)
5fn main() {
6    let colours = vec![
7        "red", "orange", "yellow", "green", "blue", "indigo", "violet",
8    ];
9
10    let fzf = Fzf::builder()
11        .layout(Layout::Reverse)
12        .border(Border::Rounded)
13        .border_label("Favourite Colour")
14        .color(Color::Bw)
15        .header("Pick your favourite colour")
16        .header_first(true)
17        .custom_args(vec!["--height=10".to_string()])
18        .build()
19        .unwrap();
20
21    let users_selection = run_with_output(fzf, colours);
22
23    if let Some(colour) = users_selection {
24        println!("{} is an awesome colour!", colour);
25    }
26}
Source

pub fn ansi<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

Enable processing of ANSI color codes

Source

pub fn tabstop<VALUE: Into<u8>>(&mut self, value: VALUE) -> &mut Self

Number of spaces for a tab character (default: 8)

Source

pub fn color<VALUE: Into<Color>>(&mut self, value: VALUE) -> &mut Self

Base scheme (dark|light|16|bw)

Examples found in repository?
examples/color.rs (line 14)
5fn main() {
6    let colours = vec![
7        "red", "orange", "yellow", "green", "blue", "indigo", "violet",
8    ];
9
10    let fzf = Fzf::builder()
11        .layout(Layout::Reverse)
12        .border(Border::Rounded)
13        .border_label("Favourite Colour")
14        .color(Color::Bw)
15        .header("Pick your favourite colour")
16        .header_first(true)
17        .custom_args(vec!["--height=10".to_string()])
18        .build()
19        .unwrap();
20
21    let users_selection = run_with_output(fzf, colours);
22
23    if let Some(colour) = users_selection {
24        println!("{} is an awesome colour!", colour);
25    }
26}
Source

pub fn no_bold<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

Do not use bold text

Source

pub fn build(&self) -> Result<Fzf, FzfBuilderError>

Builds a new Fzf.

§Errors

If a required field has not been initialized.

Examples found in repository?
examples/color.rs (line 18)
5fn main() {
6    let colours = vec![
7        "red", "orange", "yellow", "green", "blue", "indigo", "violet",
8    ];
9
10    let fzf = Fzf::builder()
11        .layout(Layout::Reverse)
12        .border(Border::Rounded)
13        .border_label("Favourite Colour")
14        .color(Color::Bw)
15        .header("Pick your favourite colour")
16        .header_first(true)
17        .custom_args(vec!["--height=10".to_string()])
18        .build()
19        .unwrap();
20
21    let users_selection = run_with_output(fzf, colours);
22
23    if let Some(colour) = users_selection {
24        println!("{} is an awesome colour!", colour);
25    }
26}
Source§

impl FzfBuilder

Source

pub fn custom_args( &mut self, args: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self

Additional arguments that this library doesn’t currently support as a predefined option

Examples found in repository?
examples/color.rs (line 17)
5fn main() {
6    let colours = vec![
7        "red", "orange", "yellow", "green", "blue", "indigo", "violet",
8    ];
9
10    let fzf = Fzf::builder()
11        .layout(Layout::Reverse)
12        .border(Border::Rounded)
13        .border_label("Favourite Colour")
14        .color(Color::Bw)
15        .header("Pick your favourite colour")
16        .header_first(true)
17        .custom_args(vec!["--height=10".to_string()])
18        .build()
19        .unwrap();
20
21    let users_selection = run_with_output(fzf, colours);
22
23    if let Some(colour) = users_selection {
24        println!("{} is an awesome colour!", colour);
25    }
26}

Trait Implementations§

Source§

impl Clone for FzfBuilder

Source§

fn clone(&self) -> FzfBuilder

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for FzfBuilder

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.