pub enum MessagePart {
Text {
text: String,
media_type: Option<String>,
},
File {
file: FilePart,
},
Data {
data: DataPart,
},
}Expand description
A part of a message — a fully-formed piece of content.
Each part has a specific type: text, file, or structured data.
Variants§
Text
Plain text content.
File
File content (inline or by reference).
Data
Structured data (JSON or other).
Implementations§
Source§impl MessagePart
impl MessagePart
Sourcepub fn text_with_type(
text: impl Into<String>,
media_type: impl Into<String>,
) -> Self
pub fn text_with_type( text: impl Into<String>, media_type: impl Into<String>, ) -> Self
Create a text part with a specific media type.
Sourcepub fn file_inline(
name: impl Into<String>,
media_type: impl Into<String>,
data: Vec<u8>,
) -> Self
pub fn file_inline( name: impl Into<String>, media_type: impl Into<String>, data: Vec<u8>, ) -> Self
Create a file part from inline bytes.
Trait Implementations§
Source§impl Clone for MessagePart
impl Clone for MessagePart
Source§fn clone(&self) -> MessagePart
fn clone(&self) -> MessagePart
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MessagePart
impl Debug for MessagePart
Source§impl<'de> Deserialize<'de> for MessagePart
impl<'de> Deserialize<'de> for MessagePart
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
Source§impl JsonSchema for MessagePart
impl JsonSchema for MessagePart
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for MessagePart
impl RefUnwindSafe for MessagePart
impl Send for MessagePart
impl Sync for MessagePart
impl Unpin for MessagePart
impl UnsafeUnpin for MessagePart
impl UnwindSafe for MessagePart
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