pub enum YamlAction {
SetField {
file: PathBuf,
parent_path: Vec<YamlPathComponent>,
key: String,
value: String,
},
SetFieldOrdered {
file: PathBuf,
parent_path: Vec<YamlPathComponent>,
key: String,
value: String,
field_order: Vec<String>,
},
RemoveField {
file: PathBuf,
parent_path: Vec<YamlPathComponent>,
key: String,
},
RenameField {
file: PathBuf,
parent_path: Vec<YamlPathComponent>,
from: String,
to: String,
},
}Expand description
Edits to a YAML file.
A YAML file is a tree of mappings, sequences and scalars; the
parent_path field navigates from the top-level document down to the
mapping that owns the key being edited. An empty parent_path means
the top-level mapping (the common case for Debian’s flat YAML files
like debian/upstream/metadata).
Each path component is either a string (mapping key) or an index (sequence position).
Variants§
SetField
Set a scalar value at parent_path’s mapping under key. Inserts
the key if missing. New keys are appended at the end of the
mapping; use SetFieldOrdered to
position the new key according to a canonical field order
(e.g. DEP-12).
Fields
parent_path: Vec<YamlPathComponent>Path from the document root to the parent mapping.
SetFieldOrdered
Like SetField, but when inserting a new key,
position it according to field_order. Keys not listed in
field_order are placed at the end. A no-op if the key already
exists with the requested value.
Fields
parent_path: Vec<YamlPathComponent>Path from the document root to the parent mapping.
RemoveField
Remove a key from the mapping at parent_path.
Fields
parent_path: Vec<YamlPathComponent>Path from the document root to the parent mapping.
RenameField
Rename a key in the mapping at parent_path, preserving its
value and position.
Trait Implementations§
Source§impl Clone for YamlAction
impl Clone for YamlAction
Source§fn clone(&self) -> YamlAction
fn clone(&self) -> YamlAction
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 YamlAction
impl Debug for YamlAction
Source§impl<'de> Deserialize<'de> for YamlAction
impl<'de> Deserialize<'de> for YamlAction
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>,
Source§impl PartialEq for YamlAction
impl PartialEq for YamlAction
Source§fn eq(&self, other: &YamlAction) -> bool
fn eq(&self, other: &YamlAction) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for YamlAction
impl Serialize for YamlAction
impl Eq for YamlAction
impl StructuralPartialEq for YamlAction
Auto Trait Implementations§
impl Freeze for YamlAction
impl RefUnwindSafe for YamlAction
impl Send for YamlAction
impl Sync for YamlAction
impl Unpin for YamlAction
impl UnsafeUnpin for YamlAction
impl UnwindSafe for YamlAction
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,
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§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.