pub struct ChatInput { /* private fields */ }Implementations§
Source§impl ChatInput
impl ChatInput
Sourcepub fn message(window: &mut Window, cx: &mut Context<'_, Self>) -> Self
pub fn message(window: &mut Window, cx: &mut Context<'_, Self>) -> Self
A Markdown message input, sharing Copilot’s minimum size and Enter bindings.
Sourcepub fn compact_message(
label: impl Into<SharedString>,
input_name: impl Into<SharedString>,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> Self
pub fn compact_message( label: impl Into<SharedString>, input_name: impl Into<SharedString>, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Self
An inset plain-text composer with a labelled send action.
An addon set on this composer appears before the shared send controls.
Sourcepub fn set_plain_text(&mut self, cx: &mut Context<'_, Self>)
pub fn set_plain_text(&mut self, cx: &mut Context<'_, Self>)
A plain-text message input for a protocol without Markdown, such as IRC: no Write/Preview and no Markdown hint.
pub fn set_busy(&mut self, busy: bool, cx: &mut Context<'_, Self>)
pub fn set_error(&mut self, error: String, cx: &mut Context<'_, Self>)
Sourcepub fn set_submit_blocked(&mut self, blocked: bool, cx: &mut Context<'_, Self>)
pub fn set_submit_blocked(&mut self, blocked: bool, cx: &mut Context<'_, Self>)
Prevents submitting the message while leaving its draft editable.
Sourcepub fn set_available_height(
&mut self,
available: f32,
cx: &mut Context<'_, Self>,
)
pub fn set_available_height( &mut self, available: f32, cx: &mut Context<'_, Self>, )
The actual board height, excluding neighbouring panes and window chrome.
Source§impl ChatInput
impl ChatInput
Sourcepub fn set_attachment_budget(
&mut self,
budget: AttachmentBudget,
cx: &mut Context<'_, Self>,
)
pub fn set_attachment_budget( &mut self, budget: AttachmentBudget, cx: &mut Context<'_, Self>, )
The owner service’s intake budget. File reads remain the owner’s responsibility.
Source§impl ChatInput
impl ChatInput
Sourcepub fn new(
engine: &str,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> Self
pub fn new( engine: &str, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Self
A composer that asks engine, the chat engine’s display name.
Sourcepub fn set_submit_empty(
&mut self,
submit_empty: bool,
cx: &mut Context<'_, Self>,
)
pub fn set_submit_empty( &mut self, submit_empty: bool, cx: &mut Context<'_, Self>, )
Whether Enter on an empty draft submits an empty text. Off by default; an owner turns it on while it has something else to send.
Sourcepub fn set_addon(&mut self, addon: Option<AnyView>, cx: &mut Context<'_, Self>)
pub fn set_addon(&mut self, addon: Option<AnyView>, cx: &mut Context<'_, Self>)
The toolbar rendered in the group’s bottom addon, or the leading tools on a compact message composer.
pub fn text(&self, cx: &App) -> String
Sourcepub fn set_limits(
&mut self,
limits: Option<DraftLimits>,
cx: &mut Context<'_, Self>,
)
pub fn set_limits( &mut self, limits: Option<DraftLimits>, cx: &mut Context<'_, Self>, )
Opts into the in-frame counter; the host owns protocol validation. Other hosts leave this unset and show no counter.
pub fn set_text( &mut self, text: &str, window: &mut Window, cx: &mut Context<'_, Self>, )
Sourcepub fn set_placeholder(
&mut self,
placeholder: impl Into<SharedString>,
window: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn set_placeholder( &mut self, placeholder: impl Into<SharedString>, window: &mut Window, cx: &mut Context<'_, Self>, )
The hint shown while the draft is empty, such as Message #channel.
pub fn clear(&mut self, window: &mut Window, cx: &mut Context<'_, Self>)
Sourcepub fn cursor(&self, cx: &App) -> usize
pub fn cursor(&self, cx: &App) -> usize
The text cursor’s byte offset, for completing the word before it.
Sourcepub fn selection(&self, cx: &App) -> Range<usize> ⓘ
pub fn selection(&self, cx: &App) -> Range<usize> ⓘ
The selected byte range, or an empty range at the cursor.
Sourcepub fn set_selection(&mut self, range: Range<usize>, cx: &mut Context<'_, Self>)
pub fn set_selection(&mut self, range: Range<usize>, cx: &mut Context<'_, Self>)
Moves the selection to a byte range in the current draft.
Sourcepub fn replace_range(
&mut self,
range: Range<usize>,
text: &str,
window: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn replace_range( &mut self, range: Range<usize>, text: &str, window: &mut Window, cx: &mut Context<'_, Self>, )
Replaces the bytes in range with text, leaving the cursor after
it, as an edit the user can undo. The text then reports
ChatInputEvent::Changed.
pub fn focus(&self, window: &mut Window, cx: &mut App)
Sourcepub fn completion_key(&self) -> Option<CompletionKey>
pub fn completion_key(&self) -> Option<CompletionKey>
The key, Tab or Enter, behind the latest ChatInputEvent::Complete
this input emitted; None before any. An owner reads it while
handling that event.
Sourcepub fn set_completing(&mut self, completing: bool, cx: &mut Context<'_, Self>)
pub fn set_completing(&mut self, completing: bool, cx: &mut Context<'_, Self>)
While a completion list is open, Enter emits
ChatInputEvent::Complete rather than sending.
Sourcepub fn set_recall_keys(&mut self, recall: bool, cx: &mut Context<'_, Self>)
pub fn set_recall_keys(&mut self, recall: bool, cx: &mut Context<'_, Self>)
Up and Down emit ChatInputEvent::Previous and
ChatInputEvent::Next, and Tab emits ChatInputEvent::Complete,
for an owner that recalls sent lines and completes names. The arrow
keys recall while the draft is empty or recalled. In an edited draft
they jump to the start and end. When a completion list is open the
arrows continue to move through its choices.
Sourcepub fn set_recalled(&mut self, recalled: bool, cx: &mut Context<'_, Self>)
pub fn set_recalled(&mut self, recalled: bool, cx: &mut Context<'_, Self>)
Whether the draft is a line the owner recalled and the user has not edited. Up and Down then keep recalling even when it has several lines, so a multi-line message does not stop the walk through the sent lines.
Sourcepub fn set_disabled(&mut self, disabled: bool, cx: &mut Context<'_, Self>)
pub fn set_disabled(&mut self, disabled: bool, cx: &mut Context<'_, Self>)
Disables the text area, for a chat that takes no message, such as a replay of a cloud agent session.
Trait Implementations§
impl EventEmitter<ChatInputEvent> for ChatInput
Auto Trait Implementations§
impl !RefUnwindSafe for ChatInput
impl !Send for ChatInput
impl !Sync for ChatInput
impl !UnwindSafe for ChatInput
impl Forget for ChatInput
impl Freeze for ChatInputwhere
NonZero<u32>: Freeze,
*const (): Freeze,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: Freeze,
PhantomData<fn(InputBaseState<TextareaMode>) -> InputBaseState<TextareaMode>>: Freeze,
&'static str: Freeze,
*const ArcInner<str> is !null: Freeze,
PhantomData<ArcInner<str>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const ArcInner<RwLock<RawRwLock, FocusMap>> is !null: Freeze,
PhantomData<ArcInner<RwLock<RawRwLock, FocusMap>>>: Freeze,
*const dyn FnOnce() is !null: Freeze,
PhantomData<dyn FnOnce()>: Freeze,
impl Move for ChatInput
impl Unpin for ChatInput
impl UnsafeUnpin for ChatInputwhere
NonZeroU32Inner: UnsafeUnpin,
*const (): UnsafeUnpin,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: UnsafeUnpin,
PhantomData<fn(InputBaseState<TextareaMode>) -> InputBaseState<TextareaMode>>: UnsafeUnpin,
&'static str: UnsafeUnpin,
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const ArcInner<RwLock<RawRwLock, FocusMap>> is !null: UnsafeUnpin,
PhantomData<ArcInner<RwLock<RawRwLock, FocusMap>>>: UnsafeUnpin,
*const dyn FnOnce() is !null: UnsafeUnpin,
PhantomData<dyn FnOnce()>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
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> ⓘ
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