Struct LastGitCommit

Source
pub struct LastGitCommit { /* private fields */ }

Implementations§

Source§

impl LastGitCommit

Source

pub fn new() -> LastGitCommitBuilder

Create new builder

Examples found in repository?
examples/path_example.rs (line 5)
3fn main() {
4
5    let lgc = LastGitCommit::new().build().unwrap();
6    let path = lgc.path();
7
8    println!("Path: {:?}", path); // "."
9
10}
More examples
Hide additional examples
examples/branch_example.rs (line 5)
3fn main() {
4
5    let lgc = LastGitCommit::new().build().unwrap();
6    let branch = lgc.branch();
7
8    println!("Branch: {}", branch); // "master"
9
10}
examples/date_example.rs (line 5)
3fn main() {
4
5    let lgc = LastGitCommit::new().build().unwrap();
6    let timestamp = lgc.timestamp();
7
8    println!("Timestamp: {}", timestamp); // 1563461711
9
10}
examples/message_example.rs (line 5)
3fn main() {
4
5    let lgc = LastGitCommit::new().build().unwrap();
6    let message = lgc.message().unwrap();
7
8    println!("Message: {}", message); // "this is a commit message"
9
10}
examples/author_example.rs (line 5)
3fn main() {
4
5    let lgc = LastGitCommit::new().build().unwrap();
6    let name = lgc.author().name().unwrap();
7    let email = lgc.author().email().unwrap();
8
9    println!("Name: {}", name); // "Jon Doe"
10    println!("Email: {}", email); // "jondoe@example.com"
11
12}
examples/id_example.rs (line 5)
3fn main() {
4
5    let lgc = LastGitCommit::new().build().unwrap();
6    let long = lgc.id().long();
7    let short = lgc.id().short();
8    let range = lgc.id().range(0..3).unwrap();
9
10    println!("Long: {}", long); // "c4f94258c12b8905f3d57f879ae1171ce367cd29"
11    println!("Short: {}", short); // "c4f9425"
12    println!("Range: {}", range); // "c4f"
13
14}
Source

pub fn path(&self) -> &PathBuf

Get path

Examples found in repository?
examples/path_example.rs (line 6)
3fn main() {
4
5    let lgc = LastGitCommit::new().build().unwrap();
6    let path = lgc.path();
7
8    println!("Path: {:?}", path); // "."
9
10}
Source

pub fn branch(&self) -> &String

Get branch

Examples found in repository?
examples/branch_example.rs (line 6)
3fn main() {
4
5    let lgc = LastGitCommit::new().build().unwrap();
6    let branch = lgc.branch();
7
8    println!("Branch: {}", branch); // "master"
9
10}
Source

pub fn message(&self) -> Option<&String>

Get commit message

Examples found in repository?
examples/message_example.rs (line 6)
3fn main() {
4
5    let lgc = LastGitCommit::new().build().unwrap();
6    let message = lgc.message().unwrap();
7
8    println!("Message: {}", message); // "this is a commit message"
9
10}
Source

pub fn author(&self) -> &Author

Get commit author

Examples found in repository?
examples/author_example.rs (line 6)
3fn main() {
4
5    let lgc = LastGitCommit::new().build().unwrap();
6    let name = lgc.author().name().unwrap();
7    let email = lgc.author().email().unwrap();
8
9    println!("Name: {}", name); // "Jon Doe"
10    println!("Email: {}", email); // "jondoe@example.com"
11
12}
Source

pub fn id(&self) -> &Id

Get commit id (hash)

Examples found in repository?
examples/id_example.rs (line 6)
3fn main() {
4
5    let lgc = LastGitCommit::new().build().unwrap();
6    let long = lgc.id().long();
7    let short = lgc.id().short();
8    let range = lgc.id().range(0..3).unwrap();
9
10    println!("Long: {}", long); // "c4f94258c12b8905f3d57f879ae1171ce367cd29"
11    println!("Short: {}", short); // "c4f9425"
12    println!("Range: {}", range); // "c4f"
13
14}
Source

pub fn timestamp(&self) -> i64

Get commit timestamp

Examples found in repository?
examples/date_example.rs (line 6)
3fn main() {
4
5    let lgc = LastGitCommit::new().build().unwrap();
6    let timestamp = lgc.timestamp();
7
8    println!("Timestamp: {}", timestamp); // 1563461711
9
10}

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,