pub struct ValidatorRef {
pub name: String,
pub function: String,
pub defined_in: Option<String>,
pub present: bool,
}Expand description
The validator a dispatched rule names, and whether anything defines it.
A validator is not a path. validator: adr names the shell function
mj_validate_adr, which the doctrine dispatcher calls; the tool finds it by scanning
lib/, exactly as majordomus doctor does. Reading it as a path is a mistake worth
recording here, because it is the one this type was introduced to fix: it makes every
dispatched rule in the vendored package report as naming something that is not in the
tree, which is the opposite of true — those are the best-enforced rules there are.
§Example
use majordomus_cli::rules::ValidatorRef;
let v = ValidatorRef {
name: "adr".into(),
function: "mj_validate_adr".into(),
defined_in: Some("lib/adr.sh".into()),
present: true,
};
assert_eq!(v.function, "mj_validate_adr");Fields§
§name: StringThe name the rule declares, without the mj_validate_ prefix.
function: StringThe function the dispatcher calls.
defined_in: Option<String>The file that defines it, when one does.
present: boolWhether anything in lib/ defines it.
Trait Implementations§
Source§impl Clone for ValidatorRef
impl Clone for ValidatorRef
Source§fn clone(&self) -> ValidatorRef
fn clone(&self) -> ValidatorRef
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 ValidatorRef
impl Debug for ValidatorRef
Source§impl<'de> Deserialize<'de> for ValidatorRef
impl<'de> Deserialize<'de> for ValidatorRef
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 ValidatorRef
Source§impl JsonSchema for ValidatorRef
impl JsonSchema for ValidatorRef
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 ValidatorRef
impl PartialEq for ValidatorRef
Source§fn eq(&self, other: &ValidatorRef) -> bool
fn eq(&self, other: &ValidatorRef) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ValidatorRef
impl Serialize for ValidatorRef
impl StructuralPartialEq for ValidatorRef
Auto Trait Implementations§
impl Freeze for ValidatorRef
impl RefUnwindSafe for ValidatorRef
impl Send for ValidatorRef
impl Sync for ValidatorRef
impl Unpin for ValidatorRef
impl UnsafeUnpin for ValidatorRef
impl UnwindSafe for ValidatorRef
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.