pub struct Info {
pub dir: String,
pub is_git: bool,
pub branch: Option<String>,
pub status: Option<Status>,
pub commits: Option<Vec<Commit>>,
}Expand description
The main struct that returns combined Status and Commits info
Fields§
§dir: StringRepo directory
is_git: boolBoolean indicating id the directory above is indeed a repo
branch: Option<String>Repo branch inspected
status: Option<Status>Status information for the repo
commits: Option<Vec<Commit>>Information on the repo commits
Implementations§
Source§impl Info
impl Info
Sourcepub fn new(dir: &str) -> Info
pub fn new(dir: &str) -> Info
To initialize the Info Struct. A &str pointing to the repo directory is expected This implementation method checks that the directory does indeed exist and that the repo is a git repo It returns a new Info Struct with the “dir” and “is_git” fields set
§Example
// let dir = "/path/to/repo"; <- Point to the location of t=your repo
let info = Info::new(&dir);
println("{:#?}", info);Sourcepub fn commit_info(&self) -> Result<Info>
pub fn commit_info(&self) -> Result<Info>
Get information of all the commits. This Method returns Info in its result. If there are no commits, the returned value is None
§Example
// let dir = "/path/to/repo"; <- Point to the location of t=your repo
let commits_info = Info::new(&dir).commit_info()?;
println("{:#?}", commits_info);Sourcepub fn status_info(&self) -> Result<Info>
pub fn status_info(&self) -> Result<Info>
This method returns status information for the repo
§Example
// let dir = "/path/to/repo"; <- Point to the location of t=your repo
let status_info = Info::new(&dir).status_info()?;
println("{:#?}", status_info);Trait Implementations§
Auto Trait Implementations§
impl Freeze for Info
impl RefUnwindSafe for Info
impl Send for Info
impl Sync for Info
impl Unpin for Info
impl UnwindSafe for Info
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