pub struct Rule {
pub id: String,
pub ecosystem: String,
pub kind: Kind,
pub markers: Vec<String>,
pub markers_required: MarkersRequired,
pub targets: Vec<String>,
pub anchor: Anchor,
pub note: Option<String>,
}Expand description
One marker-anchored rule: the evidence that a project is of some kind, and the directories that kind of project generates.
Fields§
§id: StringStable identifier. A user rule with the same id replaces the built-in one.
ecosystem: StringHuman-readable name of the ecosystem: the first half of the label.
kind: KindWhat the directories this rule claims are: the second half of the label.
A rule whose targets do not all share one kind is two rules, which is why python and
python-caches are separate and why gradle’s build and .gradle are. One rule
covering both could only label one of them honestly.
markers: Vec<String>File or directory names proving the anchor is a project of this kind. A name
containing * or ? is a glob and costs a directory listing to check.
markers_required: MarkersRequiredWhether one marker is enough.
targets: Vec<String>Reclaimable paths relative to the anchor. Multi-segment paths (vendor/bundle) and a
globbed final segment (bazel-*) are both allowed.
anchor: AnchorWhere the markers are looked for.
note: Option<String>An optional caveat to surface next to the hit.
Implementations§
Source§impl Rule
impl Rule
Sourcepub fn label(&self) -> String
pub fn label(&self) -> String
What the directories this rule claims are, named: the ecosystem and the kind.
Composed rather than written out per rule, because thirty hand-written strings are thirty chances to drift apart — and because the half that a reader groups by has to be the same word every time it appears.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Rule
impl<'de> Deserialize<'de> for Rule
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>,
impl Eq for Rule
impl StructuralPartialEq for Rule
Auto Trait Implementations§
impl Freeze for Rule
impl RefUnwindSafe for Rule
impl Send for Rule
impl Sync for Rule
impl Unpin for Rule
impl UnsafeUnpin for Rule
impl UnwindSafe for Rule
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
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>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more