IncSearch

Struct IncSearch 

Source
pub struct IncSearch<I: IncSearcher> { /* private fields */ }
Expand description

The PromptMode that makes use of IncSearchers

In order to make use of incremental search, you’d do something like this:

use duat::prelude::*;

#[derive(Clone)]
struct Emacs;

impl Mode for Emacs {
    type Widget = Buffer;

    fn send_key(&mut self, pa: &mut Pass, event: KeyEvent, handle: Handle) {
        match event {
            ctrl!('s') => _ = mode::set(pa, IncSearch::new(SearchFwd)),
            other_keys_oh_god => todo!(),
        }
    }
}

Implementations§

Source§

impl<I: IncSearcher> IncSearch<I>

Source

pub fn new(inc: I) -> Prompt

Returns a Prompt with IncSearch<I> as its PromptMode

Trait Implementations§

Source§

impl<I: IncSearcher> Clone for IncSearch<I>

Source§

fn clone(&self) -> Self

Returns a duplicate 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<I: IncSearcher> PromptMode for IncSearch<I>

Source§

type ExitWidget = Buffer

What Widget to exit to, upon pressing enter, esc, or backspace in an empty PromptLine Read more
Source§

fn update(&mut self, pa: &mut Pass, text: Text, _: &RwArea) -> Text

Updates the PromptLine and Text of the Prompt Read more
Source§

fn on_switch(&mut self, pa: &mut Pass, text: Text, _: &RwArea) -> Text

What to do when switchin onto this PromptMode Read more
Source§

fn before_exit(&mut self, pa: &mut Pass, text: Text, _: &RwArea)

What to do before exiting the PromptMode Read more
Source§

fn prompt(&self) -> Text

What text should be at the beginning of the PromptLine, as a Ghost
Source§

fn post_update(&mut self, pa: &mut Pass, handle: &Handle<PromptLine>)

A post update hook to be called on the Handle itself Read more
Source§

fn return_handle(&self) -> Option<Handle<dyn Widget>>

An optional returning Handle for the ExitWidget

Auto Trait Implementations§

§

impl<I> !Freeze for IncSearch<I>

§

impl<I> !RefUnwindSafe for IncSearch<I>

§

impl<I> Send for IncSearch<I>

§

impl<I> !Sync for IncSearch<I>

§

impl<I> Unpin for IncSearch<I>
where I: Unpin,

§

impl<I> !UnwindSafe for IncSearch<I>

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> Downcast for T
where T: Any,

Source§

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

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

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

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.
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.