#[non_exhaustive]pub struct Text {
pub text: String,
pub native: Option<Native>,
/* private fields */
}Expand description
Text. On an assistant turn, native holds the provider item the block
was decoded from, and Text::citations what the provider says supports
it; user and tool-result text leave both empty.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.text: StringText content.
native: Option<Native>The provider item this block was decoded from.
Implementations§
Source§impl Text
impl Text
Sourcepub fn citations(&self) -> &[Citation]
pub fn citations(&self) -> &[Citation]
The citations, while text is what they were resolved against;
empty once it has been edited.
Sourcepub fn with_citations(
self,
citations: impl IntoIterator<Item = Citation>,
) -> Text
pub fn with_citations( self, citations: impl IntoIterator<Item = Citation>, ) -> Text
This text with citations, bound to its current text. A citation
whose span is off a character boundary or past the end is dropped
with a warning.
Sourcepub fn clear_citations(&mut self)
pub fn clear_citations(&mut self)
Remove every citation.
Sourcepub fn cited(&self, citation: &Citation) -> Option<&str>
pub fn cited(&self, citation: &Citation) -> Option<&str>
The text citation covers: its span, or the whole block. It reads
any citation against the current text and does not check that the
citation belongs to it, so a citation kept from before an edit gives
whatever text now sits at its span, or None past the end. Read
citations through Text::citations, which hides them once the
text changes.