pub struct Location<Name> {
pub descendant: Name,
pub distance: u64,
}
Expand description
The position of one node in the graph relative their known descendant.
This structure is relevant when the IdMap is lazy. Assuming that all parents of merges
and all heads are known then any node can be represented as their first descendant
and the distance to that descendant.
Example:
0 - a - b - c
In this example our initial commit is 0
, then we have a
the first commit, b
second,
c
third.
{
descendant: c,
distance: 1,
}
=> [b]
Fields§
§descendant: Name
§distance: u64
Implementations§
source§impl<Name> Location<Name>
impl<Name> Location<Name>
pub fn new(descendant: Name, distance: u64) -> Self
pub fn map_descendant<T, F>(self, f: F) -> Location<T>where
F: FnOnce(Name) -> T,
pub fn try_map_descendant<T, E, F>(self, f: F) -> Result<Location<T>, E>where
F: FnOnce(Name) -> Result<T, E>,
pub async fn then_descendant<T, Fut, F>(self, f: F) -> Location<T>where
F: FnOnce(Name) -> Fut,
Fut: Future<Output = T>,
pub async fn and_then_descendant<T, E, Fut, F>(
self,
f: F
) -> Result<Location<T>, E>where
F: FnOnce(Name) -> Fut,
Fut: Future<Output = Result<T, E>>,
pub fn with_descendant<T>(self, descendant: T) -> Location<T>
Trait Implementations§
source§impl<'de, Name> Deserialize<'de> for Location<Name>where
Name: Deserialize<'de>,
impl<'de, Name> Deserialize<'de> for Location<Name>where
Name: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<Name: Ord> Ord for Location<Name>
impl<Name: Ord> Ord for Location<Name>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<Name: PartialEq> PartialEq<Location<Name>> for Location<Name>
impl<Name: PartialEq> PartialEq<Location<Name>> for Location<Name>
source§impl<Name: PartialOrd> PartialOrd<Location<Name>> for Location<Name>
impl<Name: PartialOrd> PartialOrd<Location<Name>> for Location<Name>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more