#[non_exhaustive]pub struct Diff {
pub changes: Vec<DiffChange>,
pub patch: Option<DiffPatch>,
pub meta: Option<Map<String, Value>>,
}unstable_protocol_v2 only.Expand description
File changes produced by a tool call.
changes identifies affected absolute paths and operations. patch
optionally carries renderable patch text for clients that can show it.
Agents SHOULD provide patch whenever feasible. Clients MUST handle diffs
where patch is omitted or null.
See protocol docs: Content
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.changes: Vec<DiffChange>Structured file changes described by this diff.
Clients can use this field without parsing patch text to determine affected paths.
patch: Option<DiffPatch>Renderable patch text.
Agents SHOULD provide patch text whenever feasible. Omitted or null
means no renderable patch text was provided.
meta: Option<Map<String, Value>>The _meta property is reserved by ACP to allow clients and agents to attach additional metadata to their interactions. Implementations MUST NOT make assumptions about values at these keys.
See protocol docs: Extensibility
Implementations§
Source§impl Diff
impl Diff
Sourcepub fn patch(diff: impl Into<String>, changes: Vec<DiffChange>) -> Diff
pub fn patch(diff: impl Into<String>, changes: Vec<DiffChange>) -> Diff
Builds Diff with git patch text and structured file changes.
Sourcepub fn with_patch(self, patch: impl IntoOption<DiffPatch>) -> Diff
pub fn with_patch(self, patch: impl IntoOption<DiffPatch>) -> Diff
Sets renderable patch text.
Sourcepub fn meta(self, meta: impl IntoOption<Map<String, Value>>) -> Diff
pub fn meta(self, meta: impl IntoOption<Map<String, Value>>) -> Diff
The _meta property is reserved by ACP to allow clients and agents to attach additional metadata to their interactions. Implementations MUST NOT make assumptions about values at these keys.
See protocol docs: Extensibility
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Diff
impl<'de> Deserialize<'de> for Diff
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Diff, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Diff, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for Diff
Source§impl From<Diff> for ToolCallContent
impl From<Diff> for ToolCallContent
Source§fn from(diff: Diff) -> ToolCallContent
fn from(diff: Diff) -> ToolCallContent
Source§impl JsonSchema for Diff
impl JsonSchema for Diff
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 Diff
impl Serialize for Diff
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 Diff
Auto Trait Implementations§
impl Freeze for Diff
impl RefUnwindSafe for Diff
impl Send for Diff
impl Sync for Diff
impl Unpin for Diff
impl UnsafeUnpin for Diff
impl UnwindSafe for Diff
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
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>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.