pub enum SystemdAction {
SetField {
file: PathBuf,
section: String,
field: String,
value: String,
},
RemoveField {
file: PathBuf,
section: String,
field: String,
},
RenameField {
file: PathBuf,
section: String,
from: String,
to: String,
},
Add {
file: PathBuf,
section: String,
field: String,
value: String,
},
RemoveValue {
file: PathBuf,
section: String,
field: String,
value: String,
},
}Expand description
Edits to a systemd unit file.
Systemd unit files are sectioned ini-style files ([Unit], [Service],
[Install], …). Each variant identifies a single section by name and
targets one entry within it.
Multi-valued fields (e.g. Alias=, After=) are handled by
Add / RemoveValue — these append a
new value or remove a specific one without touching siblings.
SetField replaces every occurrence of the key with a
single value, which is the right thing for scalar fields like PIDFile=
but the wrong thing for multi-valued ones.
Variants§
SetField
Set a scalar field. Replaces every existing entry with the given key.
Fields
RemoveField
Remove every entry with the given key.
Fields
RenameField
Rename every entry with from to to, preserving values.
Fields
Add
Append a new entry. Use for multi-valued fields like After= or
Alias= to add another value without disturbing siblings.
Fields
RemoveValue
Remove a specific value from a multi-valued field. Other values for the same key are preserved.
Trait Implementations§
Source§impl Clone for SystemdAction
impl Clone for SystemdAction
Source§fn clone(&self) -> SystemdAction
fn clone(&self) -> SystemdAction
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 SystemdAction
impl Debug for SystemdAction
Source§impl<'de> Deserialize<'de> for SystemdAction
impl<'de> Deserialize<'de> for SystemdAction
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 SystemdAction
Source§impl PartialEq for SystemdAction
impl PartialEq for SystemdAction
Source§fn eq(&self, other: &SystemdAction) -> bool
fn eq(&self, other: &SystemdAction) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for SystemdAction
impl Serialize for SystemdAction
impl StructuralPartialEq for SystemdAction
Auto Trait Implementations§
impl Freeze for SystemdAction
impl RefUnwindSafe for SystemdAction
impl Send for SystemdAction
impl Sync for SystemdAction
impl Unpin for SystemdAction
impl UnsafeUnpin for SystemdAction
impl UnwindSafe for SystemdAction
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§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.