pub struct Graph {
pub by_id: HashMap<String, usize>,
pub by_path: HashMap<String, usize>,
pub by_alias: HashMap<String, Vec<usize>>,
pub by_slug: HashMap<String, Vec<usize>>,
pub owners: Vec<String>,
pub anchors: Vec<HashSet<String>>,
pub edges: Vec<Edge>,
pub outgoing: Vec<Vec<usize>>,
pub incoming: Vec<Vec<usize>>,
}Fields§
§by_id: HashMap<String, usize>§by_path: HashMap<String, usize>§by_alias: HashMap<String, Vec<usize>>§by_slug: HashMap<String, Vec<usize>>Slug ids (plan:root/payment-rollout), resolved like aliases.
owners: Vec<String>The owner of each document, from its id.
anchors: Vec<HashSet<String>>§edges: Vec<Edge>§outgoing: Vec<Vec<usize>>§incoming: Vec<Vec<usize>>Implementations§
Source§impl Graph
impl Graph
pub fn build(c: &Corpus) -> Self
Sourcepub fn resolve(&self, text: &str) -> Resolution
pub fn resolve(&self, text: &str) -> Resolution
Resolves an id, an alias, or a path to a document, checking the anchor if there is one.
Sourcepub fn resolve_from(&self, owner: &str, text: &str) -> Resolution
pub fn resolve_from(&self, owner: &str, text: &str) -> Resolution
Resolves as written by owner: an alias or slug several owners declare names that owner’s
document when exactly one of the candidates is its own.
pub fn edges_from(&self, idx: usize) -> impl Iterator<Item = &Edge>
pub fn edges_to(&self, idx: usize) -> impl Iterator<Item = &Edge>
Trait Implementations§
Auto Trait Implementations§
impl Forget for Graph
impl Freeze for Graphwhere
*const u8 is !null: Freeze,
PhantomData<(String, usize)>: Freeze,
PhantomData<(String, Vec<usize>)>: Freeze,
PhantomData<String>: Freeze,
PhantomData<HashSet<String>>: Freeze,
PhantomData<Edge>: Freeze,
PhantomData<Vec<usize>>: Freeze,
impl Move for Graph
impl RefUnwindSafe for Graph
impl Send for Graph
impl Sync for Graph
impl Unpin for Graph
impl UnsafeUnpin for Graphwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<(String, usize)>: UnsafeUnpin,
PhantomData<(String, Vec<usize>)>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
PhantomData<HashSet<String>>: UnsafeUnpin,
PhantomData<Edge>: UnsafeUnpin,
PhantomData<Vec<usize>>: UnsafeUnpin,
impl UnwindSafe for Graphwhere
HashMap<String, usize>: UnwindSafe,
HashMap<String, Vec<usize>>: UnwindSafe,
RawVecInner: UnwindSafe,
NonNull<u8>: UnwindSafe,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more