pub enum ProposeError {
Invalid(String),
Exists(String),
Write(String),
}Expand description
Why propose wrote nothing: the input cannot make a record, a record of that identity
already exists, or the file could not be written. Each carries the sentence a caller is
shown, and the three are kept apart so that a transport can answer invalid input, a
refusal and its own failure differently.
use majordomus_cli::intent::{propose, ProposeError};
let nowhere = std::path::Path::new("/nonexistent");
// judged before anything is touched: an empty statement never reaches the disk
let e = propose(nowhere, " ", None, None, "2026-10-12").unwrap_err();
assert!(matches!(e, ProposeError::Invalid(_)));
assert_eq!(e.to_string(), "an intent needs a statement: what must become true");Variants§
Invalid(String)
The input cannot make a record: an empty statement, or an id that is not a slug.
Exists(String)
A record with this identity exists; a proposal never overwrites one.
Write(String)
The file could not be written.
Trait Implementations§
Source§impl Clone for ProposeError
impl Clone for ProposeError
Source§fn clone(&self) -> ProposeError
fn clone(&self) -> ProposeError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ProposeError
impl Debug for ProposeError
Source§impl Display for ProposeError
impl Display for ProposeError
impl Eq for ProposeError
Source§impl PartialEq for ProposeError
impl PartialEq for ProposeError
Source§fn eq(&self, other: &ProposeError) -> bool
fn eq(&self, other: &ProposeError) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ProposeError
Auto Trait Implementations§
impl Freeze for ProposeError
impl RefUnwindSafe for ProposeError
impl Send for ProposeError
impl Sync for ProposeError
impl Unpin for ProposeError
impl UnsafeUnpin for ProposeError
impl UnwindSafe for ProposeError
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.