Commit

Struct Commit 

Source
pub struct Commit {
    pub selected: bool,
    /* private fields */
}
Expand description

A graph item representing a commit in the smartlog output. It can be selected and deselected.

Fields§

§selected: bool

Implementations§

Source§

impl Commit

Source

pub fn new(parsed_lines: Vec<Vec<String>>, selected: bool) -> Self

Source

pub fn hash(&self) -> Option<&str>

Get the hash of this commit which can be used for operations such as sl goto <hash>

 let commit_lines = vec![
     vec!["  @  ", "\u{1b}[0;35m", "\u{1b}[0;93;1m", "1cee5d55e", "\u{1b}[0m", "\u{1b}[0;35m", "  Dec 08 at 09:46  royrothenberg  ", "\u{1b}[0;36m", "#780 Closed", "\u{1b}[0m", "\u{1b}[0;35m", " ", "\u{1b}[0;31m", "✗", "\u{1b}[0m"],
     vec!["  │  ", "\u{1b}[0;35m", "[pr body update] update stack list without overwriting PR title and body", "\u{1b}[0m"],
 ].iter().map(|x| x.iter().map(|x| x.to_string()).collect()).collect();
 let commit = Commit::new(commit_lines, true);
 assert_eq!(commit.hash().unwrap(), "1cee5d55e");
Source

pub fn select(&mut self)

Source

pub fn deselect(&mut self)

Trait Implementations§

Source§

impl Debug for Commit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Commit> for ItemType

Source§

fn from(v: Commit) -> ItemType

Converts to this type from the input type.
Source§

impl Item for Commit

Source§

fn parsed_lines(&self) -> &Vec<Vec<String>>

Source§

fn add_parsed_line(&mut self, parsed_line: Vec<String>)

Source§

fn to_string_vec(&self) -> Vec<String>

Source§

impl TryInto<Commit> for ItemType

Source§

type Error = &'static str

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

fn try_into(self) -> Result<Commit, <Self as TryInto<Commit>>::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl Freeze for Commit

§

impl RefUnwindSafe for Commit

§

impl Send for Commit

§

impl Sync for Commit

§

impl Unpin for Commit

§

impl UnwindSafe for Commit

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> Same for T

Source§

type Output = T

Should always be Self
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.