pub struct Part {
pub content: PartContent,
pub metadata: Option<Value>,
}Expand description
A content part within a Message or crate::artifact::Artifact.
Uses a type field discriminator per the A2A spec. In JSON:
{"type": "text", "text": "hello"}{"type": "file", "file": {"name": "f.png", "mimeType": "image/png", "bytes": "..."}}{"type": "data", "data": {...}}
Fields§
§content: PartContentThe content of this part (text, file, or data).
metadata: Option<Value>Arbitrary metadata for this part.
Implementations§
Source§impl Part
impl Part
Sourcepub fn file_bytes(bytes: impl Into<String>) -> Self
pub fn file_bytes(bytes: impl Into<String>) -> Self
Creates a file Part from raw bytes (base64-encoded).
Sourcepub const fn file(file: FileContent) -> Self
pub const fn file(file: FileContent) -> Self
Creates a file Part with full metadata.
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
impl Eq for Part
impl StructuralPartialEq for Part
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