#[non_exhaustive]pub struct DiffChange {
pub file_type: Option<DiffFileType>,
pub mime_type: Option<String>,
pub operation: DiffChangeOperation,
pub meta: Option<Meta>,
}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<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 DiffChange
impl DiffChange
Sourcepub fn new(operation: DiffChangeOperation) -> Self
pub fn new(operation: DiffChangeOperation) -> Self
Builds DiffChange with the required fields set; optional fields start unset or empty.
Sourcepub fn move_file(old_path: impl Into<PathBuf>, path: impl Into<PathBuf>) -> Self
pub fn move_file(old_path: impl Into<PathBuf>, path: impl Into<PathBuf>) -> Self
Builds a file move or rename change.
Sourcepub fn copy(old_path: impl Into<PathBuf>, path: impl Into<PathBuf>) -> Self
pub fn copy(old_path: impl Into<PathBuf>, path: impl Into<PathBuf>) -> Self
Builds a file copy change.
Sourcepub fn file_type(self, file_type: impl IntoOption<DiffFileType>) -> Self
pub fn file_type(self, file_type: impl IntoOption<DiffFileType>) -> Self
File content kind.
Omitted or null means the content kind is unknown.
Sourcepub fn mime_type(self, mime_type: impl IntoOption<String>) -> Self
pub fn mime_type(self, mime_type: impl IntoOption<String>) -> Self
MIME type of the file contents.
Omitted or null means the MIME type is unknown.
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 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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::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
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.