pub struct Rule {
pub pattern: String,
pub owners: Vec<String>,
pub description: Option<String>,
pub section: Option<String>,
}Expand description
A single code ownership rule.
Each rule maps a file pattern to one or more owners.
§Example
use cuenv_codeowners::Rule;
let rule = Rule::new("*.rs", ["@rust-team", "@backend"])
.description("Rust source files")
.section("Backend");Fields§
§pattern: StringFile pattern (glob syntax) matching files this rule applies to.
owners: Vec<String>List of owners for files matching this pattern.
description: Option<String>Optional description added as a comment above the rule.
section: Option<String>Optional section name for grouping rules in the output.
Implementations§
Source§impl Rule
impl Rule
Sourcepub fn new(
pattern: impl Into<String>,
owners: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn new( pattern: impl Into<String>, owners: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Create a new rule with a pattern and owners.
§Example
use cuenv_codeowners::Rule;
let rule = Rule::new("*.rs", ["@rust-team"]);
let rule = Rule::new("/docs/**", vec!["@docs-team", "@tech-writers"]);Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Add a description to this rule.
The description will be added as a comment above the rule in the output.
Trait Implementations§
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 UnwindSafe for Rule
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)