pub struct Collision {
pub kind: String,
pub slug: String,
pub identities: Vec<String>,
pub paths: Vec<String>,
pub correction: String,
}Expand description
Two objects of one kind whose identities reduce to the same route.
Carries both identities and both files, because the reader who has to fix it needs to
know which two things collided and where they are written — a count would tell them
only that the tree is refused. correction is the sentence collisions wrote about
this particular pair.
use majordomus_cli::entity::{collisions, Collision};
// `a.b` and `a-b` are two identities and one slug
let objects = vec![object("rule", "a.b"), object("rule", "a-b")];
let found: Vec<Collision> = collisions(&objects);
assert_eq!(found.len(), 1);
assert_eq!(found[0].kind, "rule");
assert_eq!(found[0].slug, "a-b");
assert_eq!(found[0].identities, ["a.b", "a-b"]);
assert!(!found[0].correction.is_empty());Fields§
§kind: StringThe kind they share.
slug: StringThe slug they both reduce to; empty when an identity reduces to nothing.
identities: Vec<String>The identities that collide, in index order.
paths: Vec<String>The files that declared them.
correction: StringWhat to do about it.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Collision
impl<'de> Deserialize<'de> for Collision
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 Collision
Source§impl JsonSchema for Collision
impl JsonSchema for Collision
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 moreimpl StructuralPartialEq for Collision
Auto Trait Implementations§
impl Freeze for Collision
impl RefUnwindSafe for Collision
impl Send for Collision
impl Sync for Collision
impl Unpin for Collision
impl UnsafeUnpin for Collision
impl UnwindSafe for Collision
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.