Struct Part
pub struct Part {
pub text: Option<String>,
pub raw: Option<String>,
pub url: Option<String>,
pub data: Option<Value>,
pub metadata: Option<Value>,
pub filename: Option<String>,
pub media_type: Option<String>,
}Expand description
A2A Part (proto message Part) — a section of communication content.
The content oneof is expressed without a discriminator: the active
branch is exactly one of text / raw / url / data; the shared
optional fields (metadata/filename/mediaType) ride alongside it.
The oneof invariant is enforced at deserialization (via
deserialize_part): a payload with zero content branches or more than
one is rejected, matching the proto oneof semantics (spec §5.7 — a
Part carries exactly one content branch). A struct (not an enum) lets
serde handle the field-name-keyed shape directly while a custom
deserializer validates the oneof invariant.
Fields§
§text: Option<String>§raw: Option<String>base64-encoded bytes (proto bytes JSON form).
url: Option<String>§data: Option<Value>§metadata: Option<Value>§filename: Option<String>§media_type: Option<String>Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Part
impl<'de> Deserialize<'de> for Part
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Part, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Part, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Enforce the proto oneof content invariant: exactly one of
text / raw / url / data must be present. Zero branches (empty
Part) or multiple branches are rejected, matching proto oneof
semantics (spec §5.7 — a Part carries exactly one content branch).
{"data": null} is accepted: the data key is present, so the data
branch is selected (proto3 oneof uses key presence, not value
nullness).
Source§impl JsonSchema for Part
impl JsonSchema for Part
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 moreSource§impl Serialize for Part
impl Serialize for Part
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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§
§impl<T> AnyEq for T
impl<T> AnyEq for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more