Struct erg_compiler::module::graph::ModuleGraph
source · pub struct ModuleGraph(_);
Implementations§
source§impl ModuleGraph
impl ModuleGraph
pub fn new() -> Self
pub fn get_node(&self, path: &Path) -> Option<&Node<NormalizedPathBuf, ()>>
sourcepub fn depends_on(&self, path: &Path, target: &Path) -> bool
pub fn depends_on(&self, path: &Path, target: &Path) -> bool
if path
depends on target
, returns true
, else false
.
if path
not found, returns false
pub fn children(&self, path: &Path) -> Set<NormalizedPathBuf>
sourcepub fn ancestors(&self, path: &Path) -> Set<NormalizedPathBuf>
pub fn ancestors(&self, path: &Path) -> Set<NormalizedPathBuf>
# a.er
b = import "b"
-> a: child, b: parent
pub fn add_node_if_none(&mut self, path: &Path)
sourcepub fn inc_ref(
&mut self,
referrer: &Path,
depends_on: PathBuf
) -> Result<(), IncRefError>
pub fn inc_ref( &mut self, referrer: &Path, depends_on: PathBuf ) -> Result<(), IncRefError>
returns Err (and do nothing) if this operation makes a cycle
pub fn iter(&self) -> impl Iterator<Item = &Node<NormalizedPathBuf, ()>>
pub fn sorted(self) -> Result<Self, TopoSortError>
pub fn sort(&mut self) -> Result<(), TopoSortError>
pub fn remove(&mut self, path: &Path)
pub fn rename_path(&mut self, old: &Path, new: PathBuf)
pub fn initialize(&mut self)
Trait Implementations§
source§impl Clone for ModuleGraph
impl Clone for ModuleGraph
source§fn clone(&self) -> ModuleGraph
fn clone(&self) -> ModuleGraph
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ModuleGraph
impl Debug for ModuleGraph
source§impl Default for ModuleGraph
impl Default for ModuleGraph
source§fn default() -> ModuleGraph
fn default() -> ModuleGraph
Returns the “default value” for a type. Read more
source§impl Display for ModuleGraph
impl Display for ModuleGraph
source§impl IntoIterator for ModuleGraph
impl IntoIterator for ModuleGraph
Auto Trait Implementations§
impl RefUnwindSafe for ModuleGraph
impl Send for ModuleGraph
impl Sync for ModuleGraph
impl Unpin for ModuleGraph
impl UnwindSafe for ModuleGraph
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