pub struct MessageParts { /* private fields */ }Expand description
A bounded, ordered, non-empty list of content parts.
The hard v1 boundary permits at most 64 parts and 2 MiB of materialized inline text plus compact JSON. Artifact bytes do not count because they are resolved through the separately bounded artifact boundary. Runtime and provider policies may impose lower limits before invocation.
Implementations§
Source§impl MessageParts
impl MessageParts
Sourcepub const MAX_INLINE_PAYLOAD_BYTES: usize
pub const MAX_INLINE_PAYLOAD_BYTES: usize
Maximum aggregate materialized text and compact JSON bytes.
Sourcepub fn try_new<I>(values: I) -> Result<Self, MessagePartsError>where
I: IntoIterator<Item = ContentPart>,
pub fn try_new<I>(values: I) -> Result<Self, MessagePartsError>where
I: IntoIterator<Item = ContentPart>,
Validates and constructs an ordered, non-empty part list.
§Errors
Returns MessagePartsError on the first empty, count, or aggregate
inline-payload violation. Iteration stops at that violation.
Sourcepub const fn as_slice(&self) -> &[ContentPart]
pub const fn as_slice(&self) -> &[ContentPart]
Returns the ordered parts.
Sourcepub fn iter(&self) -> Iter<'_, ContentPart> ⓘ
pub fn iter(&self) -> Iter<'_, ContentPart> ⓘ
Returns an iterator over ordered parts.
Sourcepub const fn is_empty(&self) -> bool
pub const fn is_empty(&self) -> bool
Returns whether the list is empty.
Valid instances always return false; this method supports generic
collection code without weakening construction invariants.
Sourcepub const fn inline_payload_bytes(&self) -> usize
pub const fn inline_payload_bytes(&self) -> usize
Returns aggregate inline text and compact JSON payload bytes.
Trait Implementations§
Source§impl Clone for MessageParts
impl Clone for MessageParts
Source§impl Debug for MessageParts
impl Debug for MessageParts
Source§impl<'de> Deserialize<'de> for MessageParts
impl<'de> Deserialize<'de> for MessageParts
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>,
impl Eq for MessageParts
Source§impl<'a> IntoIterator for &'a MessageParts
impl<'a> IntoIterator for &'a MessageParts
Source§impl JsonSchema for MessageParts
impl JsonSchema for MessageParts
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more