pub struct ComponentGraph { /* private fields */ }Expand description
A read-only component dependency graph for a bundled DjVu document.
Implementations§
Source§impl ComponentGraph
impl ComponentGraph
Sourcepub fn parse(bytes: &[u8]) -> Result<ComponentGraph, GraphError>
pub fn parse(bytes: &[u8]) -> Result<ComponentGraph, GraphError>
Parse a bundled FORM:DJVM document and build its component graph.
A malformed IFF container, DIRM payload, or embedded component body
returns GraphError::Malformed. Missing INCL targets, duplicate DIRM
identities, and component-type disagreements are retained for
Self::validate instead.
Sourcepub fn nodes(&self) -> &[ComponentNode]
pub fn nodes(&self) -> &[ComponentNode]
All component nodes in DIRM directory order.
Sourcepub fn node(&self, id: &str) -> Option<&ComponentNode>
pub fn node(&self, id: &str) -> Option<&ComponentNode>
Look up a component by its DIRM identity.
When a DIRM identity is duplicated, this returns the first declaration;
Self::validate reports the duplicate.
Sourcepub fn includes(&self, id: &str) -> Vec<&ComponentNode>
pub fn includes(&self, id: &str) -> Vec<&ComponentNode>
Outgoing INCL targets of id, in INCL chunk order.
Sourcepub fn included_by(&self, id: &str) -> Vec<&ComponentNode>
pub fn included_by(&self, id: &str) -> Vec<&ComponentNode>
Components that INCL id, in DIRM order without duplicates.
Sourcepub fn transitive_closure(&self, roots: &[&str]) -> Vec<usize>
pub fn transitive_closure(&self, roots: &[&str]) -> Vec<usize>
Transitive INCL closure of the given root identities, including roots.
The traversal is iterative and bounded. Unknown roots are ignored, and a resource cap returns the prefix discovered before that cap.
Sourcepub fn unreachable_components(&self) -> Vec<usize>
pub fn unreachable_components(&self) -> Vec<usize>
Nodes not reachable from any page, in DIRM directory order.
Sourcepub fn validate(&self) -> Vec<GraphError>
pub fn validate(&self) -> Vec<GraphError>
All graph-shaped validation problems.
This includes errors retained by Self::parse and every cycle found
by a bounded, iterative depth-first walk of the INCL graph.
Auto Trait Implementations§
impl Freeze for ComponentGraph
impl RefUnwindSafe for ComponentGraph
impl Send for ComponentGraph
impl Sync for ComponentGraph
impl Unpin for ComponentGraph
impl UnsafeUnpin for ComponentGraph
impl UnwindSafe for ComponentGraph
Blanket Implementations§
impl<T> Any for Twhere
T: Any,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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> ⓘ
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> ⓘ
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