pub struct Input { /* private fields */ }Expand description
An unstyled single-line text input.
Applications that need a fully styled control can wrap this state with
their own presentation using super::InputBase and GPUI styles.
Implementations§
Source§impl Input
impl Input
pub fn new(state: &Entity<InputState>) -> Self
Sourcepub fn token<R: IntoElement>(
self,
render: impl Fn(&InlineTokenContext, &mut Window, &mut App) -> R + 'static,
) -> Self
pub fn token<R: IntoElement>( self, render: impl Fn(&InlineTokenContext, &mut Window, &mut App) -> R + 'static, ) -> Self
The element each atomic token renders as; the input keeps editing and history.
Sourcepub fn on_token_click(
self,
listener: impl Fn(&InlineTokenClickEvent, &mut Window, &mut App) + 'static,
) -> Self
pub fn on_token_click( self, listener: impl Fn(&InlineTokenClickEvent, &mut Window, &mut App) + 'static, ) -> Self
Open a reference after a completed, unconsumed token click.
Sourcepub fn on_token_hover(
self,
listener: impl Fn(&InlineTokenHoverEvent, &mut Window, &mut App) + 'static,
) -> Self
pub fn on_token_hover( self, listener: impl Fn(&InlineTokenHoverEvent, &mut Window, &mut App) + 'static, ) -> Self
Report pointer presence over a token; hover never selects or edits.
Trait Implementations§
Source§impl IntoElement for Input
impl IntoElement for Input
Source§type Element = ViewElement<Input>
type Element = ViewElement<Input>
The specific type of element into which the implementing type is converted.
Useful for converting other types into elements automatically, like Strings
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Convert self into a type that implements
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
Convert self into a dynamically-typed
AnyElement.Source§impl RenderOnce for Input
impl RenderOnce for Input
Source§fn render(self, _: &mut Window, cx: &mut App) -> impl IntoElement
fn render(self, _: &mut Window, cx: &mut App) -> impl IntoElement
Render this component into an element tree. Note that this method
takes ownership of self, as compared to
Render::render() method
which takes a mutable reference.Auto Trait Implementations§
impl !RefUnwindSafe for Input
impl !Send for Input
impl !Sync for Input
impl !UnwindSafe for Input
impl Forget for Input
impl Freeze for Inputwhere
*const RcInner<dyn Fn(&InlineTokenContext, &mut Window, &mut App) -> AnyElement> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&InlineTokenContext, &mut Window, &mut App) -> AnyElement>>: Freeze,
*const RcInner<dyn Fn(&InlineTokenClickEvent, &mut Window, &mut App)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&InlineTokenClickEvent, &mut Window, &mut App)>>: Freeze,
*const RcInner<dyn Fn(&InlineTokenHoverEvent, &mut Window, &mut App)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&InlineTokenHoverEvent, &mut Window, &mut App)>>: Freeze,
NonZero<u32>: Freeze,
*const (): Freeze,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: Freeze,
PhantomData<fn(InputBaseState<InputMode>) -> InputBaseState<InputMode>>: Freeze,
impl Move for Input
impl Unpin for Inputwhere
Rc<dyn Fn(&InlineTokenContext, &mut Window, &mut App) -> AnyElement>: Unpin,
Rc<dyn Fn(&InlineTokenClickEvent, &mut Window, &mut App)>: Unpin,
Rc<dyn Fn(&InlineTokenHoverEvent, &mut Window, &mut App)>: Unpin,
NonZero<u32>: Unpin,
*const (): Unpin,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: Unpin,
impl UnsafeUnpin for Inputwhere
*const RcInner<dyn Fn(&InlineTokenContext, &mut Window, &mut App) -> AnyElement> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&InlineTokenContext, &mut Window, &mut App) -> AnyElement>>: UnsafeUnpin,
*const RcInner<dyn Fn(&InlineTokenClickEvent, &mut Window, &mut App)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&InlineTokenClickEvent, &mut Window, &mut App)>>: UnsafeUnpin,
*const RcInner<dyn Fn(&InlineTokenHoverEvent, &mut Window, &mut App)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&InlineTokenHoverEvent, &mut Window, &mut App)>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
*const (): UnsafeUnpin,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: UnsafeUnpin,
PhantomData<fn(InputBaseState<InputMode>) -> InputBaseState<InputMode>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Render this component or element with an animation
Source§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Render this component or element with a chain of animations
Source§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>
fn with_spring<T>( self, id: impl Into<ElementId>, animation: SpringAnimation<T>, animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static, ) -> SpringAnimationElement<Self>
Renders this component or element at the value produced by a spring. Read more
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Imperatively modify self with the given closure.
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Conditionally modify self with the given closure.
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
Conditionally modify self with the given closure.
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
Source§fn test_text(
self,
text: impl Into<SharedString>,
) -> ObservedTextElement<Self::Element>
fn test_text( self, text: impl Into<SharedString>, ) -> ObservedTextElement<Self::Element>
With
test-support, records text each time the element paints.
Otherwise returns the element it builds.Source§fn test_alt_text(
self,
text: impl Into<SharedString>,
) -> ObservedTextElement<Self::Element>
fn test_alt_text( self, text: impl Into<SharedString>, ) -> ObservedTextElement<Self::Element>
Like
Self::test_text for an image’s alternative text, which
stands in for what the element draws.