pub struct EditVerdict {
pub allowed: bool,
pub path: String,
pub ground: String,
pub detail: String,
pub remedy: Option<String>,
}Expand description
The answer to one edit: whether it may proceed, the one word it was decided on, the
sentence a person reads and, for a refusal, what would allow it. guard.edit returns it
as it is; guard hook turns it into an exit code.
use majordomus_cli::guard::{judge_facts, ClaimSource, EditFacts, EditVerdict};
let facts = EditFacts {
required: Ok(false),
mesh_enabled: true,
task: None,
session: None,
claims: ClaimSource::Claims(vec![]),
};
let v: EditVerdict = judge_facts("a.md", Some("a.md"), facts);
assert!(v.allowed);
assert_eq!(v.ground, "off");
let json = serde_json::to_value(&v).unwrap();
assert!(json.get("remedy").is_none(), "an allowed edit carries no remedy");Fields§
§allowed: boolWhether the edit may proceed.
path: StringThe path asked about, repository-relative when it is inside the checkout.
ground: StringWhy, as one word: off, outside, local, no_mesh, task, claim,
undecided or unclaimed. Only unclaimed refuses.
detail: StringThe sentence a person reads.
remedy: Option<String>What makes the edit allowed, when it is refused.
Trait Implementations§
Source§impl Clone for EditVerdict
impl Clone for EditVerdict
Source§fn clone(&self) -> EditVerdict
fn clone(&self) -> EditVerdict
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 EditVerdict
impl Debug for EditVerdict
Source§impl<'de> Deserialize<'de> for EditVerdict
impl<'de> Deserialize<'de> for EditVerdict
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for EditVerdict
Source§impl JsonSchema for EditVerdict
impl JsonSchema for EditVerdict
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for EditVerdict
impl PartialEq for EditVerdict
Source§fn eq(&self, other: &EditVerdict) -> bool
fn eq(&self, other: &EditVerdict) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for EditVerdict
impl Serialize for EditVerdict
impl StructuralPartialEq for EditVerdict
Auto Trait Implementations§
impl Freeze for EditVerdict
impl RefUnwindSafe for EditVerdict
impl Send for EditVerdict
impl Sync for EditVerdict
impl Unpin for EditVerdict
impl UnsafeUnpin for EditVerdict
impl UnwindSafe for EditVerdict
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<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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.