pub struct GatePlan {
pub mode: GatePlanMode,
pub reason: String,
pub changed: Vec<String>,
pub classes: Vec<GateClassMatch>,
pub unclassified: Vec<String>,
pub selected: BTreeMap<String, String>,
pub excluded: BTreeMap<String, String>,
}Expand description
use majordomus_cli::gates::{GateClassMatch, GatePlan, GatePlanMode};
use std::collections::BTreeMap;
let plan = GatePlan {
mode: GatePlanMode::Affected,
reason: "3 path(s) fall in 1 class".into(),
changed: vec!["docs/CLI.md".into()],
classes: vec![GateClassMatch { id: "docs".into(), paths: vec!["docs/CLI.md".into()] }],
unclassified: Vec::new(),
selected: BTreeMap::from([("reference-check".to_string(), "class docs".to_string())]),
excluded: BTreeMap::new(),
};
// the plan says what it selected and why, so a reader can check it rather than believe it
assert_eq!(plan.selected["reference-check"], "class docs");
assert!(!plan.selected.contains_key("rust-check"), "a document change cannot break the crate");Which gates a change must pass, and why each one is in or out.
Fields§
§mode: GatePlanModeAffected, or full.
reason: StringWhy, in words.
changed: Vec<String>The changed paths the plan was computed over, sorted.
classes: Vec<GateClassMatch>The classes they fall in.
unclassified: Vec<String>Changed paths no class of the model covers; each one escalates the plan.
selected: BTreeMap<String, String>Gate id to the reason it was selected, for the gates in the plan.
excluded: BTreeMap<String, String>Gate id to the reason it was left out, for the gates that are not.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for GatePlan
impl<'de> Deserialize<'de> for GatePlan
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
Source§impl JsonSchema for GatePlan
impl JsonSchema for GatePlan
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 moreAuto Trait Implementations§
impl Freeze for GatePlan
impl RefUnwindSafe for GatePlan
impl Send for GatePlan
impl Sync for GatePlan
impl Unpin for GatePlan
impl UnsafeUnpin for GatePlan
impl UnwindSafe for GatePlan
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