pub struct CopyButton { /* private fields */ }Expand description
A button that copies caller-supplied text and confirms what happened.
Implementations§
Source§impl CopyButton
impl CopyButton
pub fn new( ident: impl Into<Ident>, _window: &mut Window, cx: &mut Context<'_, Self>, ) -> Self
Sourcepub fn text(self, text: impl Into<SharedString>) -> Self
pub fn text(self, text: impl Into<SharedString>) -> Self
The text this button copies. Never published: a copy button is a plausible carrier of a credential, so the tree gets the button, not its payload.
Sourcepub fn set_text(
&mut self,
text: impl Into<SharedString>,
cx: &mut Context<'_, Self>,
)
pub fn set_text( &mut self, text: impl Into<SharedString>, cx: &mut Context<'_, Self>, )
Replaces the payload from the host side, between frames.
Sourcepub fn label(self, label: impl Into<SharedString>) -> Self
pub fn label(self, label: impl Into<SharedString>) -> Self
Words on the button instead of the catalogue’s own.
Sourcepub fn glyph_only(self, name: impl Into<SharedString>) -> Self
pub fn glyph_only(self, name: impl Into<SharedString>) -> Self
Draws the button as a square carrying only its glyph, and names it.
pub fn variant(self, variant: ButtonVariant) -> Self
Sourcepub fn copier(
self,
copier: impl Fn(&str, &mut App) -> Result<(), SharedString> + 'static,
) -> Self
pub fn copier( self, copier: impl Fn(&str, &mut App) -> Result<(), SharedString> + 'static, ) -> Self
Supplies a host that knows whether the copy worked.
The default writes to the platform clipboard and reads it back; a host with a better answer replaces it, and the failure text it returns is shown verbatim rather than reworded.
Sourcepub fn confirmation(self, confirmation: Duration) -> Self
pub fn confirmation(self, confirmation: Duration) -> Self
How long a confirmation stays. A refusal is not timed and this does not touch it.
pub fn state(&self) -> &CopyState
pub fn set_disabled(&mut self, disabled: bool, cx: &mut Context<'_, Self>)
Trait Implementations§
Source§impl Debug for CopyButton
impl Debug for CopyButton
Source§impl Disableable for CopyButton
impl Disableable for CopyButton
impl EventEmitter<CopyEvent> for CopyButton
Source§impl Focusable for CopyButton
impl Focusable for CopyButton
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 CopyButton
impl Render for CopyButton
Auto Trait Implementations§
impl !RefUnwindSafe for CopyButton
impl !Send for CopyButton
impl !Sync for CopyButton
impl !UnwindSafe for CopyButton
impl Freeze for CopyButton
impl Unpin for CopyButton
impl UnsafeUnpin for CopyButton
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