pub struct Part {
pub content: PartContent,
pub filename: Option<String>,
pub media_type: Option<String>,
pub metadata: Option<HashMap<String, Value>>,
}Expand description
A content part of a message or artifact. Uses field-presence serialization (like C# SDK) so only the relevant content field is present in JSON.
Fields§
§content: PartContent§filename: Option<String>Optional filename for file parts.
media_type: Option<String>MIME type of the part content.
metadata: Option<HashMap<String, Value>>Optional metadata for extensions.
Implementations§
Source§impl Part
impl Part
pub fn text(text: impl Into<String>) -> Self
pub fn raw(data: Vec<u8>) -> Self
pub fn url(url: impl Into<String>) -> Self
pub fn data(value: Value) -> Self
pub fn with_media_type(self, media_type: impl Into<String>) -> Self
pub fn with_filename(self, filename: impl Into<String>) -> Self
pub fn as_text(&self) -> Option<&str>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Part
impl<'de> Deserialize<'de> for Part
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
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