pub struct Repository { /* private fields */ }Expand description
A repository of Architecture Decision Records.
Implementations§
Source§impl Repository
impl Repository
Sourcepub fn open(root: impl Into<PathBuf>) -> Result<Self>
pub fn open(root: impl Into<PathBuf>) -> Result<Self>
Open an existing repository at the given root.
Sourcepub fn open_or_default(root: impl Into<PathBuf>) -> Self
pub fn open_or_default(root: impl Into<PathBuf>) -> Self
Open a repository, or create default config if not found.
Sourcepub fn init(
root: impl Into<PathBuf>,
adr_dir: Option<PathBuf>,
ng: bool,
) -> Result<Self>
pub fn init( root: impl Into<PathBuf>, adr_dir: Option<PathBuf>, ng: bool, ) -> Result<Self>
Initialize a new repository at the given root.
Sourcepub fn with_template_format(self, format: TemplateFormat) -> Self
pub fn with_template_format(self, format: TemplateFormat) -> Self
Set the template format.
Sourcepub fn with_template_variant(self, variant: TemplateVariant) -> Self
pub fn with_template_variant(self, variant: TemplateVariant) -> Self
Set the template variant.
Sourcepub fn with_custom_template(self, template: Template) -> Self
pub fn with_custom_template(self, template: Template) -> Self
Set a custom template.
Sourcepub fn next_number(&self) -> Result<u32>
pub fn next_number(&self) -> Result<u32>
Get the next available ADR number.
Sourcepub fn find(&self, query: &str) -> Result<Adr>
pub fn find(&self, query: &str) -> Result<Adr>
Find an ADR by query (number or fuzzy title match).
Sourcepub fn new_adr(&self, title: impl Into<String>) -> Result<(Adr, PathBuf)>
pub fn new_adr(&self, title: impl Into<String>) -> Result<(Adr, PathBuf)>
Create a new ADR with the given title.
Sourcepub fn supersede(
&self,
title: impl Into<String>,
superseded: u32,
) -> Result<(Adr, PathBuf)>
pub fn supersede( &self, title: impl Into<String>, superseded: u32, ) -> Result<(Adr, PathBuf)>
Create a new ADR that supersedes another.
Sourcepub fn set_status(
&self,
number: u32,
status: AdrStatus,
superseded_by: Option<u32>,
) -> Result<PathBuf>
pub fn set_status( &self, number: u32, status: AdrStatus, superseded_by: Option<u32>, ) -> Result<PathBuf>
Change the status of an ADR.
If the new status is Superseded and superseded_by is provided,
a superseded-by link will be added automatically.
Sourcepub fn link(
&self,
source: u32,
target: u32,
source_kind: LinkKind,
target_kind: LinkKind,
) -> Result<()>
pub fn link( &self, source: u32, target: u32, source_kind: LinkKind, target_kind: LinkKind, ) -> Result<()>
Link two ADRs together.
Sourcepub fn read_content(&self, adr: &Adr) -> Result<String>
pub fn read_content(&self, adr: &Adr) -> Result<String>
Read the content of an ADR file.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Repository
impl RefUnwindSafe for Repository
impl Send for Repository
impl Sync for Repository
impl Unpin for Repository
impl UnwindSafe for Repository
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