pub struct Declaration {
pub version: u64,
pub in: Vec<String>,
pub out: Out,
}Expand description
scope.yaml, typed. Unknown keys are refused by the type and by the scope schema.
Fields§
§version: u64The format version; only SCOPE_VERSION is read.
in: Vec<String>The allow-list: pathspecs anchored at the repository root.
out: OutWhat is never read; wins over in.
Implementations§
Source§impl Declaration
impl Declaration
Sourcepub fn parse(path: &Path, text: &str) -> Result<Self, Error>
pub fn parse(path: &Path, text: &str) -> Result<Self, Error>
Parse and validate the text of a scope.yaml: the version, and every pattern
well-formed (no leading slash, no :( prefix, no .. segment, a name pattern
with no slash).
use majordomus_cli::scope::Declaration;
use std::path::Path;
let text = "version: 1\nin:\n - src/**\nout:\n paths: ['.git/']\n";
let d = Declaration::parse(Path::new("scope.yaml"), text).unwrap();
assert_eq!(d.r#in, vec!["src/**"]);
assert!(Declaration::parse(Path::new("s"), &text.replace("version: 1", "version: 2")).is_err());
assert!(Declaration::parse(Path::new("s"), &text.replace("src/**", "/src/**")).is_err());Trait Implementations§
Source§impl Clone for Declaration
impl Clone for Declaration
Source§fn clone(&self) -> Declaration
fn clone(&self) -> Declaration
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 Declaration
impl Debug for Declaration
Source§impl<'de> Deserialize<'de> for Declaration
impl<'de> Deserialize<'de> for Declaration
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 Declaration
Source§impl JsonSchema for Declaration
impl JsonSchema for Declaration
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 Declaration
impl PartialEq for Declaration
Source§fn eq(&self, other: &Declaration) -> bool
fn eq(&self, other: &Declaration) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for Declaration
impl Serialize for Declaration
impl StructuralPartialEq for Declaration
Auto Trait Implementations§
impl Freeze for Declaration
impl RefUnwindSafe for Declaration
impl Send for Declaration
impl Sync for Declaration
impl Unpin for Declaration
impl UnsafeUnpin for Declaration
impl UnwindSafe for Declaration
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.