pub struct ToolBody { /* private fields */ }Expand description
A block of caller-owned text — the arguments a tool was called with, or what it returned — with an optional limit on how much of it is drawn.
The body keeps the whole text so the component can say how much it left out, and draws only what the limit allows. Nothing but the measurement reaches the semantic tree.
Implementations§
Source§impl ToolBody
impl ToolBody
pub fn new(text: impl Into<SharedString>) -> Self
Sourcepub fn max_lines(self, lines: usize) -> Self
pub fn max_lines(self, lines: usize) -> Self
Draws at most this many lines and states how many there are in total.
A limit of zero is one line: a body that drew nothing at all and called itself truncated would be indistinguishable from a body nobody passed.
Sourcepub fn text(&self) -> &SharedString
pub fn text(&self) -> &SharedString
The text as the caller gave it. It is the caller’s own data coming back, and the component never publishes it.
pub fn line_count(&self) -> usize
pub fn shown_line_count(&self) -> usize
pub fn is_truncated(&self) -> bool
Sourcepub fn shape(&self, cx: &App) -> SharedString
pub fn shape(&self, cx: &App) -> SharedString
The measurement a reader is shown and a node publishes: never the text.
Trait Implementations§
impl Eq for ToolBody
Source§fn from(value: SharedString) -> Self
fn from(value: SharedString) -> Self
Converts to this type from the input type.
impl StructuralPartialEq for ToolBody
Auto Trait Implementations§
impl Freeze for ToolBody
impl RefUnwindSafe for ToolBody
impl Send for ToolBody
impl Sync for ToolBody
impl Unpin for ToolBody
impl UnsafeUnpin for ToolBody
impl UnwindSafe for ToolBody
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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