pub enum Content {
String(String),
Bytes(Bytes),
Object {
raw: Option<String>,
bytes: Option<Bytes>,
text: Option<String>,
markdown: Option<String>,
html2text: Option<String>,
screenshot: Option<Bytes>,
},
}Variants§
String(String)
A raw string (e.g. plain text or HTML).
Bytes(Bytes)
Raw binary bytes.
Object
Structured object with optional formats.
Implementations§
Source§impl Content
impl Content
Sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
Return the best-guess string representation of the content.
Sourcepub fn as_utf8_lossy(&self) -> Option<String>
pub fn as_utf8_lossy(&self) -> Option<String>
Return text content or a fallback string view of bytes if UTF-8.
Sourcepub fn has_screenshot(&self) -> bool
pub fn has_screenshot(&self) -> bool
Check if the content is a screenshot (binary).
Sourcepub fn extract_plaintext(&self) -> Option<String>
pub fn extract_plaintext(&self) -> Option<String>
Try to extract a plain .html or .txt suitable string.
Sourcepub fn available_keys(&self) -> Vec<&'static str>
pub fn available_keys(&self) -> Vec<&'static str>
Returns all the content keys available.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Content
impl<'de> Deserialize<'de> for Content
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl !Freeze for Content
impl RefUnwindSafe for Content
impl Send for Content
impl Sync for Content
impl Unpin for Content
impl UnwindSafe for Content
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