Skip to main content

GitGraph

Struct GitGraph 

Source
pub struct GitGraph {
    pub branches: Vec<Branch>,
    pub commits: Vec<Commit>,
    pub events: Vec<Event>,
}
Expand description

A parsed gitGraph diagram.

branches lists all branches in creation order (main always first). commits lists all commits in timeline order (the order they were emitted by the source). events is the source-ordered operation log used by the renderer to determine row ordering and glyph connections.

Constructed by crate::parser::git_graph::parse and consumed by crate::render::git_graph::render.

Fields§

§branches: Vec<Branch>

All branches in branch-creation order; main is always at index 0.

§commits: Vec<Commit>

All commits in timeline order (the order they appear in the source).

§events: Vec<Event>

Source-ordered event log for the layout pass to replay.

Implementations§

Source§

impl GitGraph

Source

pub fn lane_of(&self, branch_name: &str) -> Option<usize>

Return the lane index (0-based column) assigned to branch_name.

Lanes are assigned in branch-creation order so main is always lane 0. Returns None if the branch does not exist.

Source

pub fn head_of(&self, branch_name: &str) -> Option<usize>

Return the index of the most recent commit on branch_name, scanning backwards through commits to find the last one on that branch.

Returns None if no commit exists on the branch yet.

Trait Implementations§

Source§

impl Clone for GitGraph

Source§

fn clone(&self) -> GitGraph

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GitGraph

Source§

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

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

impl Default for GitGraph

Source§

fn default() -> GitGraph

Returns the “default value” for a type. Read more
Source§

impl PartialEq for GitGraph

Source§

fn eq(&self, other: &GitGraph) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for GitGraph

Source§

impl StructuralPartialEq for GitGraph

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.