Skip to main content

DependencyGraph

Struct DependencyGraph 

Source
pub struct DependencyGraph {
    pub root: NodeId,
    pub nodes: Vec<Node>,
    pub edges: Vec<Edge>,
    pub declared_interpreter: Option<PathBuf>,
    pub executable_search_paths: Vec<String>,
    /* private fields */
}

Fields§

§root: NodeId§nodes: Vec<Node>§edges: Vec<Edge>

Every edge, in insertion order.

§declared_interpreter: Option<PathBuf>

PT_INTERP exactly as declared by the executable, before symlinks are followed. This is the path the kernel will use at runtime.

§executable_search_paths: Vec<String>

DT_RPATH and DT_RUNPATH of the executable, verbatim and unexpanded. They travel with the binary, so they matter when it is installed somewhere other than where it was built.

Implementations§

Source§

impl DependencyGraph

Source

pub fn new() -> DependencyGraph

Source

pub fn node_count(&self) -> usize

Source

pub fn insert(&mut self, node: Node) -> Result<NodeId>

Insert a node, deduplicating on the logical source path.

Re-inserting a known object merges its symlink chain: the same library is often reached through several link paths (/lib64/ld-linux… and /lib/<tuple>/ld-linux…), and every one of them must be preserved.

Source

pub fn find(&self, logical: &Path) -> Option<NodeId>

Source

pub fn connect( &mut self, from: NodeId, to: NodeId, reason: DependencyReason, ) -> Result<()>

Source

pub fn contains(&self, id: NodeId) -> bool

Source

pub fn node(&self, id: NodeId) -> &Node

Source

pub fn root_node(&self) -> &Node

Source

pub fn edges_from(&self, id: NodeId) -> impl Iterator<Item = &Edge>

Edges leaving a node, in insertion order.

Source

pub fn dependencies(&self, id: NodeId) -> Vec<(&Edge, &Node)>

Direct dependencies of a node, in insertion order.

Source

pub fn first_dependent(&self, id: NodeId) -> Option<(&Edge, &Node)>

First object that pulled in id, used for diagnostics and manifests.

Source

pub fn iter(&self) -> impl Iterator<Item = (NodeId, &Node)>

Nodes paired with their ids, in insertion order. The only way to obtain a NodeId for a node short of looking it up by its logical path.

Source

pub fn shared_objects(&self) -> impl Iterator<Item = &Node>

Source

pub fn total_size(&self) -> u64

Source

pub fn application_closure(&self) -> HashSet<NodeId>

Nodes reachable from the executable through its own ELF dependencies.

Objects that only runtime policy asked for (NSS modules and their own dependencies) stay out of this set. They are in the image, but the application never declared them.

Trait Implementations§

Source§

impl Clone for DependencyGraph

Source§

fn clone(&self) -> DependencyGraph

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 DependencyGraph

Source§

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

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

impl Default for DependencyGraph

Source§

fn default() -> DependencyGraph

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

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

Source§

type Output = T

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