#[non_exhaustive]pub struct DiffChange {
pub file_type: Option<DiffFileType>,
pub mime_type: Option<String>,
pub operation: DiffChangeOperation,
pub meta: Option<Map<String, Value>>,
}unstable_protocol_v2 only.Expand description
One file-level change described by a Diff.
Structured change metadata lets clients identify affected files and operations without parsing the text patch.
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.file_type: Option<DiffFileType>File content kind.
Omitted or null means the content kind is unknown.
mime_type: Option<String>MIME type of the file contents.
Omitted or null means the MIME type is unknown.
operation: DiffChangeOperationFile operation-specific fields.
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 DiffChange
impl DiffChange
Sourcepub fn new(operation: DiffChangeOperation) -> DiffChange
pub fn new(operation: DiffChangeOperation) -> DiffChange
Builds DiffChange with the required fields set; optional fields start unset or empty.
Sourcepub fn add(path: impl Into<PathBuf>) -> DiffChange
pub fn add(path: impl Into<PathBuf>) -> DiffChange
Builds a file add change.
Sourcepub fn delete(path: impl Into<PathBuf>) -> DiffChange
pub fn delete(path: impl Into<PathBuf>) -> DiffChange
Builds a file delete change.
Sourcepub fn modify(path: impl Into<PathBuf>) -> DiffChange
pub fn modify(path: impl Into<PathBuf>) -> DiffChange
Builds a file modify change.
Sourcepub fn move_file(
old_path: impl Into<PathBuf>,
path: impl Into<PathBuf>,
) -> DiffChange
pub fn move_file( old_path: impl Into<PathBuf>, path: impl Into<PathBuf>, ) -> DiffChange
Builds a file move or rename change.
Sourcepub fn copy(
old_path: impl Into<PathBuf>,
path: impl Into<PathBuf>,
) -> DiffChange
pub fn copy( old_path: impl Into<PathBuf>, path: impl Into<PathBuf>, ) -> DiffChange
Builds a file copy change.
Sourcepub fn file_type(self, file_type: impl IntoOption<DiffFileType>) -> DiffChange
pub fn file_type(self, file_type: impl IntoOption<DiffFileType>) -> DiffChange
File content kind.
Omitted or null means the content kind is unknown.
Sourcepub fn mime_type(self, mime_type: impl IntoOption<String>) -> DiffChange
pub fn mime_type(self, mime_type: impl IntoOption<String>) -> DiffChange
MIME type of the file contents.
Omitted or null means the MIME type is unknown.
Sourcepub fn meta(self, meta: impl IntoOption<Map<String, Value>>) -> DiffChange
pub fn meta(self, meta: impl IntoOption<Map<String, Value>>) -> DiffChange
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 Clone for DiffChange
impl Clone for DiffChange
Source§fn clone(&self) -> DiffChange
fn clone(&self) -> DiffChange
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DiffChange
impl Debug for DiffChange
Source§impl<'de> Deserialize<'de> for DiffChange
impl<'de> Deserialize<'de> for DiffChange
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DiffChange, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DiffChange, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for DiffChange
Source§impl JsonSchema for DiffChange
impl JsonSchema for DiffChange
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 PartialEq for DiffChange
impl PartialEq for DiffChange
Source§fn eq(&self, other: &DiffChange) -> bool
fn eq(&self, other: &DiffChange) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for DiffChange
impl Serialize for DiffChange
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 DiffChange
Auto Trait Implementations§
impl Freeze for DiffChange
impl RefUnwindSafe for DiffChange
impl Send for DiffChange
impl Sync for DiffChange
impl Unpin for DiffChange
impl UnsafeUnpin for DiffChange
impl UnwindSafe for DiffChange
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.