pub struct KeybindingRecorder { /* private fields */ }Expand description
A field that records one keystroke.
Whether recording is in flight is transient view state, so this is a view rather than a builder. The binding itself is not: the recorder reports the keystroke that was pressed and renders whatever the caller says is bound, so a host that refuses a binding keeps showing the one that still holds.
Implementations§
Source§impl KeybindingRecorder
impl KeybindingRecorder
pub fn new( ident: impl Into<Ident>, _window: &mut Window, cx: &mut Context<'_, Self>, ) -> Self
Sourcepub fn label(self, label: impl Into<SharedString>) -> Self
pub fn label(self, label: impl Into<SharedString>) -> Self
What the binding is for, for a reader that has only the tree.
pub fn placeholder(self, placeholder: impl Into<SharedString>) -> Self
Sourcepub fn binding(self, binding: impl Into<SharedString>) -> Self
pub fn binding(self, binding: impl Into<SharedString>) -> Self
The binding the caller says is current, in GPUI’s syntax.
pub fn set_binding( &mut self, binding: Option<SharedString>, cx: &mut Context<'_, Self>, )
Sourcepub fn conflict(self, reason: Option<impl Into<SharedString>>) -> Self
pub fn conflict(self, reason: Option<impl Into<SharedString>>) -> Self
The conflict the host found, in its own words.
The recorder has no keymap and never decides that two bindings clash.
pub fn set_conflict( &mut self, reason: Option<SharedString>, cx: &mut Context<'_, Self>, )
Sourcepub fn allow_escape(self, allow: bool) -> Self
pub fn allow_escape(self, allow: bool) -> Self
Lets escape be captured as a binding rather than ending recording.
A caller that turns this on owes the typist another way out, because the usual one is now a keystroke the recorder eats.
pub fn is_recording(&self) -> bool
pub fn current_binding(&self) -> Option<&SharedString>
Trait Implementations§
Source§impl Debug for KeybindingRecorder
impl Debug for KeybindingRecorder
Source§impl Disableable for KeybindingRecorder
impl Disableable for KeybindingRecorder
impl EventEmitter<KeybindingRecorderEvent> for KeybindingRecorder
Source§impl Focusable for KeybindingRecorder
impl Focusable for KeybindingRecorder
Source§fn focus_handle(&self, _cx: &App) -> FocusHandle
fn focus_handle(&self, _cx: &App) -> FocusHandle
Returns the focus handle associated with this view.
Source§impl Render for KeybindingRecorder
impl Render for KeybindingRecorder
Auto Trait Implementations§
impl !RefUnwindSafe for KeybindingRecorder
impl !UnwindSafe for KeybindingRecorder
impl Freeze for KeybindingRecorder
impl Send for KeybindingRecorder
impl Sync for KeybindingRecorder
impl Unpin for KeybindingRecorder
impl UnsafeUnpin for KeybindingRecorder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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