pub struct Part {
pub content: PartContent,
pub media_type: Option<String>,
pub filename: Option<String>,
pub metadata: Option<String>,
}Expand description
One piece of a message or artifact: exactly one of text, raw bytes, a URL or structured data, with an optional media type and file name.
Fields§
§content: PartContent§media_type: Option<String>§filename: Option<String>§metadata: Option<String>Raw JSON object, as sent.
Implementations§
Source§impl Part
impl Part
pub fn text(text: impl Into<String>) -> Part
Sourcepub fn data(json: impl Into<String>) -> Part
pub fn data(json: impl Into<String>) -> Part
Structured data from its JSON text ({"total": 42}).
pub fn raw(bytes: Vec<u8>, media_type: &str) -> Part
pub fn url(url: impl Into<String>, media_type: &str) -> Part
pub fn filename(self, name: impl Into<String>) -> Part
Trait Implementations§
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