pub struct Layout { /* private fields */ }Expand description
Where the tracker lives: a root directory and the project prefix inside it.
Implementations§
Source§impl Layout
impl Layout
Sourcepub fn new(root: impl Into<PathBuf>, prefix: impl Into<String>) -> Self
pub fn new(root: impl Into<PathBuf>, prefix: impl Into<String>) -> Self
Build a layout from an explicit root and prefix.
An empty prefix falls back to DEFAULT_PREFIX.
Sourcepub fn resolve(root: Option<&Path>, prefix: Option<&str>) -> Result<Self>
pub fn resolve(root: Option<&Path>, prefix: Option<&str>) -> Result<Self>
Resolve from explicit arguments, falling back to the environment, the
directory the caller stands in, the seat’s own file, and finally the
compiled defaults. See [choose_root] for the order and why.
§Errors
Returns an error if the current directory cannot be resolved, or if
<root>/vissue.toml exists but cannot be read or parsed.
Sourcepub fn require_tracker(&self) -> Result<()>
pub fn require_tracker(&self) -> Result<()>
Refuse a guessed root that holds no tracker.
A reading verb answering “none” is indistinguishable from a tracker with nothing in it, and the two mean opposite things: one is an answer and the other is a caller standing in the wrong directory. A root somebody named is trusted, empty or not, because they said which one they meant.
§Errors
crate::error::Error::NotATracker when the root was the working
directory and carries neither vissue.toml nor the prefix directory.
Sourcepub fn prefix(&self) -> &str
pub fn prefix(&self) -> &str
Directory name under Self::root that holds one subdirectory per project.
Sourcepub fn projects_dir(&self) -> PathBuf
pub fn projects_dir(&self) -> PathBuf
<root>/<prefix>: the directory scanned for projects.
Sourcepub fn project_issues_path(&self, project: &str) -> PathBuf
pub fn project_issues_path(&self, project: &str) -> PathBuf
<root>/<prefix>/<project>/issues.org.
Trait Implementations§
impl Eq for Layout
impl StructuralPartialEq for Layout
Auto Trait Implementations§
impl Freeze for Layout
impl RefUnwindSafe for Layout
impl Send for Layout
impl Sync for Layout
impl Unpin for Layout
impl UnsafeUnpin for Layout
impl UnwindSafe for Layout
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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