#[non_exhaustive]pub struct Diff {
pub changes: Vec<DiffChange>,
pub patch: Option<DiffPatch>,
pub meta: Option<Meta>,
}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<Meta>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 new(changes: Vec<DiffChange>) -> Self
pub fn new(changes: Vec<DiffChange>) -> Self
Builds Diff with structured file changes.
Sourcepub fn patch(diff: impl Into<String>, changes: Vec<DiffChange>) -> Self
pub fn patch(diff: impl Into<String>, changes: Vec<DiffChange>) -> Self
Builds Diff with git patch text and structured file changes.
Sourcepub fn with_patch(self, patch: impl IntoOption<DiffPatch>) -> Self
pub fn with_patch(self, patch: impl IntoOption<DiffPatch>) -> Self
Sets renderable patch text.
Sourcepub fn meta(self, meta: impl IntoOption<Meta>) -> Self
pub fn meta(self, meta: impl IntoOption<Meta>) -> Self
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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Diff
Source§impl From<Diff> for ToolCallContent
impl From<Diff> for 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 moreimpl 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.