pub enum SpecCommandEffect {
Read,
Write,
Destructive,
}Expand description
What running a command does to the world.
This is a coarse, three-way classification rather than a permission model. It exists so a spec can distinguish “safe to run to find something out” from “changes state” from “may destroy something”, which is the distinction consumers keep reinventing:
- documentation and
--helpcan mark destructive commands - a shell wrapper can require confirmation
- an AI coding agent can be given an allowlist of read-only commands rather than asking about every invocation
It is deliberately not inherited by subcommands. git remote and
git remote remove do different things, and silently inheriting an effect
from a parent would make the strictest reading of a spec the wrong one.
Variants§
Read
Only inspects state. Running it twice is the same as running it once, and not running it changes nothing.
Write
Creates or modifies state, but does not remove anything the user cannot recreate by running another command.
Destructive
May delete or irreversibly overwrite something. Deserves a confirmation prompt.
Implementations§
Trait Implementations§
Source§impl Clone for SpecCommandEffect
impl Clone for SpecCommandEffect
Source§fn clone(&self) -> SpecCommandEffect
fn clone(&self) -> SpecCommandEffect
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SpecCommandEffect
Source§impl Debug for SpecCommandEffect
impl Debug for SpecCommandEffect
Source§impl Display for SpecCommandEffect
impl Display for SpecCommandEffect
impl Eq for SpecCommandEffect
Source§impl FromStr for SpecCommandEffect
impl FromStr for SpecCommandEffect
Source§impl PartialEq for SpecCommandEffect
impl PartialEq for SpecCommandEffect
Source§impl Serialize for SpecCommandEffect
impl Serialize for SpecCommandEffect
impl StructuralPartialEq for SpecCommandEffect
Auto Trait Implementations§
impl Freeze for SpecCommandEffect
impl RefUnwindSafe for SpecCommandEffect
impl Send for SpecCommandEffect
impl Sync for SpecCommandEffect
impl Unpin for SpecCommandEffect
impl UnsafeUnpin for SpecCommandEffect
impl UnwindSafe for SpecCommandEffect
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more