pub struct Part {
pub text: Option<String>,
pub raw: Option<Vec<u8>>,
pub url: Option<String>,
pub data: Option<Value>,
pub metadata: Option<JsonObject>,
pub filename: Option<String>,
pub media_type: Option<String>,
}Expand description
Flat content part used in messages and artifacts.
Fields§
§text: Option<String>Plain-text content.
raw: Option<Vec<u8>>Raw binary content encoded as base64 in JSON.
url: Option<String>URL content reference.
data: Option<Value>Structured JSON content.
metadata: Option<JsonObject>Optional metadata for the part.
filename: Option<String>Optional filename for file-like parts.
media_type: Option<String>Optional media type for the content.
Implementations§
Source§impl Part
impl Part
Sourcepub fn content_count(&self) -> usize
pub fn content_count(&self) -> usize
Count how many mutually-exclusive content fields are populated.
Sourcepub fn has_single_content(&self) -> bool
pub fn has_single_content(&self) -> bool
Return true when exactly one content field is populated.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Part
impl<'de> Deserialize<'de> for Part
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 Part
impl RefUnwindSafe for Part
impl Send for Part
impl Sync for Part
impl Unpin for Part
impl UnsafeUnpin for Part
impl UnwindSafe for Part
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