pub struct RichTextState { /* private fields */ }Expand description
Retained state for a RichText document supporting incremental streaming,
selection inspection, and clamping checks.
Implementations§
Source§impl RichTextState
impl RichTextState
Sourcepub fn markdown(
text: &str,
cx: &mut Context<'_, RichTextState>,
) -> RichTextState
pub fn markdown( text: &str, cx: &mut Context<'_, RichTextState>, ) -> RichTextState
Creates a retained Markdown rich-text state.
Sourcepub fn html(text: &str, cx: &mut Context<'_, RichTextState>) -> RichTextState
pub fn html(text: &str, cx: &mut Context<'_, RichTextState>) -> RichTextState
Creates a retained HTML rich-text state.
Sourcepub fn set_text(&mut self, text: &str, cx: &mut Context<'_, RichTextState>)
pub fn set_text(&mut self, text: &str, cx: &mut Context<'_, RichTextState>)
Replaces the document source (or extends incrementally when text starts with the
current Markdown content).
Sourcepub fn push_str(&mut self, chunk: &str, cx: &mut Context<'_, RichTextState>)
pub fn push_str(&mut self, chunk: &str, cx: &mut Context<'_, RichTextState>)
Appends a streaming text delta to the document.
Sourcepub fn selected_text(&self, cx: &App) -> String
pub fn selected_text(&self, cx: &App) -> String
Returns the currently selected text in this rich-text view.
Sourcepub fn rendered_text(&self, cx: &App) -> String
pub fn rendered_text(&self, cx: &App) -> String
Returns the plain rendered text of the latest committed parse.
Sourcepub fn is_clamped(&self, cx: &App) -> bool
pub fn is_clamped(&self, cx: &App) -> bool
Returns whether the last painted frame clipped content because of RichText::max_lines.
Sourcepub fn set_selectable(
&mut self,
selectable: bool,
cx: &mut Context<'_, RichTextState>,
)
pub fn set_selectable( &mut self, selectable: bool, cx: &mut Context<'_, RichTextState>, )
Sets whether text selection is enabled.
Sourcepub fn set_scrollable(
&mut self,
scrollable: bool,
cx: &mut Context<'_, RichTextState>,
)
pub fn set_scrollable( &mut self, scrollable: bool, cx: &mut Context<'_, RichTextState>, )
Sets whether the view uses internal virtualized scrolling.
Sourcepub fn set_selection_format(
&mut self,
format: RichTextSelectionFormat,
cx: &mut Context<'_, RichTextState>,
)
pub fn set_selection_format( &mut self, format: RichTextSelectionFormat, cx: &mut Context<'_, RichTextState>, )
Sets the selection copy format.
Trait Implementations§
Source§impl Render for RichTextState
impl Render for RichTextState
Source§fn render(
&mut self,
_: &mut Window,
_: &mut Context<'_, RichTextState>,
) -> impl IntoElement
fn render( &mut self, _: &mut Window, _: &mut Context<'_, RichTextState>, ) -> impl IntoElement
Render this view into an element tree.
Auto Trait Implementations§
impl !RefUnwindSafe for RichTextState
impl !Send for RichTextState
impl !Sync for RichTextState
impl !UnwindSafe for RichTextState
impl Forget for RichTextState
impl Freeze for RichTextState
impl Move for RichTextState
impl Unpin for RichTextState
impl UnsafeUnpin for RichTextStatewhere
NonZeroU32Inner: UnsafeUnpin,
*const (): UnsafeUnpin,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: UnsafeUnpin,
PhantomData<fn(TextViewState) -> TextViewState>: 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
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> 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