### Access::from Source: https://docs.rs/archaven/1.1.0/archaven/struct.Access.html Starts an access rule from a source pattern. This is the initial step in defining an access dependency. ```APIDOC ## Access::from ### Description Starts an access rule from a source pattern. ### Method ```rust pub fn from(pattern: impl Into) -> Self ``` ### Parameters #### Path Parameters - **pattern** (impl Into) - Required - The source pattern to start the access rule from. ``` -------------------------------- ### DependencyGraph::new Source: https://docs.rs/archaven/1.1.0/archaven/struct.DependencyGraph.html Creates a new, empty DependencyGraph. This is the starting point for building a graph from scratch. ```APIDOC ## DependencyGraph::new ### Description Creates an empty graph. ### Method `new()` ### Returns - `Self`: A new, empty `DependencyGraph` instance. ``` -------------------------------- ### Starts an access rule from a source pattern Source: https://docs.rs/archaven/1.1.0/archaven/struct.Access.html Use the `from` function to initiate an access rule by specifying the source path pattern. ```rust pub fn from(pattern: impl Into) -> Self ``` -------------------------------- ### Get All Dependencies Source: https://docs.rs/archaven/1.1.0/archaven/struct.DependencyGraph.html Retrieves a slice containing all dependencies currently in the graph, in the order they were discovered. ```rust pub fn dependencies(&self) -> &[Dependency] ``` -------------------------------- ### Get Matched Prefix Source: https://docs.rs/archaven/1.1.0/archaven/struct.PrefixMatch.html Retrieves the portion of the module path that was successfully matched by the pattern. ```rust pub fn matched(&self) -> &ModulePath ``` -------------------------------- ### Get Discovered Source Directories Source: https://docs.rs/archaven/1.1.0/archaven/struct.DependencyGraph.html Returns a slice of all source directories found during dependency discovery, in their discovery order. ```rust pub fn directories(&self) -> &[SourceDirectory] ``` -------------------------------- ### Get Source File Path Source: https://docs.rs/archaven/1.1.0/archaven/struct.Location.html Returns a reference to the source file path stored in the Location instance. ```rust pub fn file(&self) -> &Path ``` -------------------------------- ### Get Remainder of Module Path Source: https://docs.rs/archaven/1.1.0/archaven/struct.PrefixMatch.html Retrieves the part of the module path that comes after the matched prefix. ```rust pub fn remainder(&self) -> &ModulePath ``` -------------------------------- ### Get Source Module Path Source: https://docs.rs/archaven/1.1.0/archaven/struct.Dependency.html Retrieves a reference to the source module path of the dependency. ```rust pub fn source(&self) -> &ModulePath ``` -------------------------------- ### Create an Empty Archaven Checker Source: https://docs.rs/archaven/1.1.0/archaven/struct.Archaven.html Instantiates a new, empty Archaven checker. This is the starting point before adding any rules or configurations. ```rust pub fn new() -> Self ``` -------------------------------- ### Get Source Directory Path Source: https://docs.rs/archaven/1.1.0/archaven/struct.SourceDirectory.html Retrieves the file system path of the source directory. This method is part of the SourceDirectory implementation. ```rust pub fn path(&self) -> &Path ``` -------------------------------- ### Get Target Module Path Source: https://docs.rs/archaven/1.1.0/archaven/struct.Dependency.html Retrieves a reference to the target module path of the dependency. ```rust pub fn target(&self) -> &ModulePath ``` -------------------------------- ### Archaven::include_external_dependencies Source: https://docs.rs/archaven/1.1.0/archaven/struct.Archaven.html Configures Archaven to record and check dependencies that start with non-local crate or module roots. By default, only local dependencies are checked. ```APIDOC ## Archaven::include_external_dependencies ### Description Records dependencies that start with non-local crate or module roots. By default, Archaven records only dependencies that resolve to local module roots. Use this when architecture rules should also check direct dependencies on external crates such as `sea_orm` or `axum`. ### Method `pub fn include_external_dependencies(self) -> Self` ``` -------------------------------- ### Get Module Path Segments Source: https://docs.rs/archaven/1.1.0/archaven/struct.ModulePath.html Returns a slice of strings representing the segments of the ModulePath. ```rust pub fn segments(&self) -> &[String] ``` -------------------------------- ### Get Dependency Location Source: https://docs.rs/archaven/1.1.0/archaven/struct.Dependency.html Retrieves a reference to the location where the dependency was found. ```rust pub fn location(&self) -> &Location ``` -------------------------------- ### Get Source Line Number Source: https://docs.rs/archaven/1.1.0/archaven/struct.Location.html Returns the 1-based source line number if available. Returns None if the line number is not specified. ```rust pub fn line(&self) -> Option ``` -------------------------------- ### Include External Dependencies in Archaven Checks Source: https://docs.rs/archaven/1.1.0/archaven/struct.Archaven.html Configures Archaven to record dependencies that start with non-local crate or module roots. Use this when architecture rules should also check direct dependencies on external crates. ```rust pub fn include_external_dependencies(self) -> Self ``` -------------------------------- ### Get TypeId of a Generic Type Source: https://docs.rs/archaven/1.1.0/archaven/struct.PrefixMatch.html Gets the `TypeId` of the current type. This is part of the `Any` trait implementation. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Get Rule Name Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violation.html Retrieves the name of the rule that was violated. This is useful for identifying the type of violation. ```rust pub fn rule_name(&self) -> &str ``` -------------------------------- ### Get Violation Reason Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violation.html Retrieves the specific reason for the violation. This provides detailed context about why the rule was broken. ```rust pub fn reason(&self) -> &str ``` -------------------------------- ### Get Rust Module Path Source: https://docs.rs/archaven/1.1.0/archaven/struct.SourceDirectory.html Retrieves the Rust module path represented by this source directory. This method is part of the SourceDirectory implementation. ```rust pub fn module(&self) -> &ModulePath ``` -------------------------------- ### Get Source Column Number Source: https://docs.rs/archaven/1.1.0/archaven/struct.Location.html Returns the 1-based source column number if available. Returns None if the column number is not specified. ```rust pub fn column(&self) -> Option ``` -------------------------------- ### Get Rust File Names Source: https://docs.rs/archaven/1.1.0/archaven/struct.SourceDirectory.html Retrieves a set of Rust file names directly contained within this source directory. This method is part of the SourceDirectory implementation. ```rust pub fn files(&self) -> &BTreeSet ``` -------------------------------- ### Get Child Directory Names Source: https://docs.rs/archaven/1.1.0/archaven/struct.SourceDirectory.html Retrieves a set of child directory names directly contained within this source directory. This method is part of the SourceDirectory implementation. ```rust pub fn child_directories(&self) -> &BTreeSet ``` -------------------------------- ### Get the Number of Violations Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violations.html Returns the total count of violations currently stored in the Violations collection. Use this to determine the size of the violation list. ```rust pub fn len(&self) -> usize ``` -------------------------------- ### Location::new Source: https://docs.rs/archaven/1.1.0/archaven/struct.Location.html Creates a new Location instance with a given file path. Line and column information are not set. ```APIDOC ## Location::new ### Description Creates a location with a file path and no line or column. ### Signature ```rust pub fn new(file: impl AsRef) -> Self ``` ``` -------------------------------- ### Archaven::new Source: https://docs.rs/archaven/1.1.0/archaven/struct.Archaven.html Creates a new, empty Archaven checker instance. ```APIDOC ## Archaven::new ### Description Creates an empty checker. ### Method `pub fn new() -> Self` ``` -------------------------------- ### Create Location with File Path Source: https://docs.rs/archaven/1.1.0/archaven/struct.Location.html Creates a new Location instance with a specified file path. Line and column information are not included. ```rust pub fn new(file: impl AsRef) -> Self ``` -------------------------------- ### Create a New Dependency Source: https://docs.rs/archaven/1.1.0/archaven/struct.Dependency.html Constructs a new `Dependency` instance. Requires source module path, target module path, and the location where the dependency was found. ```rust pub fn new(source: ModulePath, target: ModulePath, location: Location) -> Self ``` -------------------------------- ### Define and Check Dependency Rules Source: https://docs.rs/archaven/1.1.0/archaven/index.html This snippet demonstrates how to define a dependency rule using Archaven's policy language and then check for violations in the source code. It sets up a rule to deny all access between certain contexts but allows specific access patterns. Ensure the Archaven crate is added as a dependency. ```rust use archaven::{Access, Archaven, Rule}; let violations = Archaven::new() .rule( Rule::between("app::*") .named("bounded contexts") .deny_all() .allow( Access::from("*::infrastructure::adapter::**") .to("*::application::command::**"), ), ) .check("./src")?; assert!(violations.is_empty(), "{violations}"); ``` -------------------------------- ### Match Path Prefix Source: https://docs.rs/archaven/1.1.0/archaven/struct.PathPattern.html Attempts to match the PathPattern against a prefix of the given ModulePath. Returns the shortest matching prefix if successful. ```rust pub fn match_prefix(&self, path: &ModulePath) -> Option ``` -------------------------------- ### Create Rule for Source Directories Source: https://docs.rs/archaven/1.1.0/archaven/struct.Rule.html Creates a rule specifically for dependencies found within source directories that match a given module path pattern. Use this to enforce structure within specific directory trees. ```rust pub fn directories(scope: impl Into) -> Self ``` -------------------------------- ### Compare Dependencies for Equality Source: https://docs.rs/archaven/1.1.0/archaven/struct.Dependency.html Tests if two `Dependency` values are equal. This is part of the `PartialEq` trait implementation. ```rust fn eq(&self, other: &Dependency) -> bool ``` -------------------------------- ### Deny All Dependencies by Default Source: https://docs.rs/archaven/1.1.0/archaven/struct.Rule.html Configures the rule to deny all dependencies within its scope unless explicitly allowed by an `allow` directive. Use this to enforce a strict default policy. ```rust pub fn deny_all(self) -> Self ``` -------------------------------- ### DependencyGraph::from_dependencies Source: https://docs.rs/archaven/1.1.0/archaven/struct.DependencyGraph.html Constructs a DependencyGraph from an iterator of dependencies. This is useful for initializing the graph with a known set of dependencies. ```APIDOC ## DependencyGraph::from_dependencies ### Description Creates a graph from dependencies. ### Method `from_dependencies(dependencies: I)` ### Parameters #### Path Parameters - `dependencies` (I): An iterator yielding `Dependency` items. ### Returns - `Self`: A `DependencyGraph` populated with the provided dependencies. ``` -------------------------------- ### Default DependencyGraph Source: https://docs.rs/archaven/1.1.0/archaven/struct.DependencyGraph.html Provides a default, empty DependencyGraph. This is equivalent to calling `DependencyGraph::new()`. ```rust fn default() -> DependencyGraph ``` -------------------------------- ### PathPattern::match_prefix Source: https://docs.rs/archaven/1.1.0/archaven/struct.PathPattern.html Attempts to match the PathPattern against a prefix of a given ModulePath. ```APIDOC ## PathPattern::match_prefix ### Description Matches this pattern against a prefix of `path`. When multiple prefixes match, the shortest matching prefix is returned. ### Method `pub fn match_prefix(&self, path: &ModulePath) -> Option` ### Parameters #### Path Parameters - **path** (`&ModulePath`) - The module path to match against. ``` -------------------------------- ### Archaven::check Source: https://docs.rs/archaven/1.1.0/archaven/struct.Archaven.html Scans a specified source directory and returns all detected dependency violations. Handles errors related to directory walking, file reading/parsing, and invalid rule patterns. ```APIDOC ## Archaven::check ### Description Scans a source directory and returns all dependency violations. ### Method `pub fn check(&self, root: impl AsRef) -> Result` ### Parameters * `root` (impl AsRef): The root path of the source directory to scan. ### Errors Returns an error when the directory cannot be walked, a Rust file cannot be read or parsed, or a configured rule contains an invalid pattern. ``` -------------------------------- ### Create DependencyGraph from Dependencies Source: https://docs.rs/archaven/1.1.0/archaven/struct.DependencyGraph.html Constructs a DependencyGraph from an iterator of Dependency items. Ensure your dependencies are correctly formatted before using this. ```rust pub fn from_dependencies(dependencies: I) -> Self where I: IntoIterator, ``` -------------------------------- ### Rule Configuration Source: https://docs.rs/archaven/1.1.0/archaven/struct.Rule.html Methods for configuring and modifying rules. ```APIDOC ## Rule Configuration ### `named(self, name: impl Into) -> Self` Sets a human-readable rule name. ### `deny_all(self) -> Self` Denies all dependencies in this rule’s scope unless an `allow` matches. ### `allow(self, access: Access) -> Self` Adds an allowed access exception. ### `deny(self, access: Access) -> Self` Adds an explicitly denied access pattern. ### `ignore_files(self, patterns: I) -> Self` where I: IntoIterator, S: AsRef Ignores dependencies discovered in source files matching the given glob patterns. ### `ignore_module_roots(self) -> Self` Ignores dependencies discovered in Rust module root files. Module root files are `mod.rs`, `lib.rs`, and files named after a child directory such as `orders.rs` for an `orders/` directory. ### `allow_only_module_roots(self) -> Self` Allows only Rust module root files directly inside matching directories. Matching directories may contain `mod.rs`, `lib.rs`, and files named after child directories such as `orders.rs` for an `orders/` directory. ### `because(self, reason: impl Into) -> Self` Adds a default reason used when no more specific reason is available. ``` -------------------------------- ### Rule Creation Source: https://docs.rs/archaven/1.1.0/archaven/struct.Rule.html Methods for creating different types of rules. ```APIDOC ## Rule Creation ### `new()` Creates a global rule over absolute module path patterns. ### `between(scope: impl Into) -> Self` Creates a rule for dependencies between different instances of a scope pattern. ### `within(scope: impl Into) -> Self` Creates a rule for dependencies inside the same instance of a scope pattern. ### `directories(scope: impl Into) -> Self` Creates a rule for source directories matching a module path pattern. ``` -------------------------------- ### PathPattern::matches Source: https://docs.rs/archaven/1.1.0/archaven/struct.PathPattern.html Checks if a given ModulePath fully matches the PathPattern. ```APIDOC ## PathPattern::matches ### Description Returns `true` when this pattern matches the full path. ### Method `pub fn matches(&self, path: &ModulePath) -> bool` ### Parameters #### Path Parameters - **path** (`&ModulePath`) - The module path to check against the pattern. ``` -------------------------------- ### Tests for equality between two Access values Source: https://docs.rs/archaven/1.1.0/archaven/struct.Access.html Implements `PartialEq` for `Access`, providing the `eq` method to test for equality between two `Access` instances. ```rust fn eq(&self, other: &Access) -> bool ``` -------------------------------- ### Access::to Source: https://docs.rs/archaven/1.1.0/archaven/struct.Access.html Adds one allowed or denied target pattern to an existing access rule. This method chains after `from`. ```APIDOC ## Access::to ### Description Adds one allowed or denied target pattern to an access rule. ### Method ```rust pub fn to(self, pattern: impl Into) -> Self ``` ### Parameters #### Path Parameters - **pattern** (impl Into) - Required - The target pattern to add to the access rule. ``` -------------------------------- ### Compare PrefixMatch for Inequality Source: https://docs.rs/archaven/1.1.0/archaven/struct.PrefixMatch.html Tests if two PrefixMatch instances are not equal. The default implementation is usually sufficient. ```rust fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### DependencyGraph::directories Source: https://docs.rs/archaven/1.1.0/archaven/struct.DependencyGraph.html Returns a list of all source directories that were discovered and added to the DependencyGraph, in their discovery order. ```APIDOC ## DependencyGraph::directories ### Description Returns discovered source directories in discovery order. ### Method `directories(&self)` ### Returns - `&[SourceDirectory]`: A slice containing all discovered source directories in discovery order. ``` -------------------------------- ### Compare SourceDirectory for Equality Source: https://docs.rs/archaven/1.1.0/archaven/struct.SourceDirectory.html Tests if two SourceDirectory values are equal. This method is used by the equality operator (==) and is part of the PartialEq trait implementation. ```rust fn eq(&self, other: &SourceDirectory) -> bool ``` -------------------------------- ### Match Full Module Path Source: https://docs.rs/archaven/1.1.0/archaven/struct.PathPattern.html Checks if the PathPattern matches the entire provided ModulePath. Returns a boolean indicating whether a match occurred. ```rust pub fn matches(&self, path: &ModulePath) -> bool ``` -------------------------------- ### Try Convert From Another Type Source: https://docs.rs/archaven/1.1.0/archaven/struct.PrefixMatch.html Performs the conversion from `U` to `T`. Returns a `Result` which is `Ok` on success or an `Err` if the conversion fails. ```rust fn try_from(value: U) -> Result>::Error> ``` -------------------------------- ### To String Conversion Source: https://docs.rs/archaven/1.1.0/archaven/struct.ModulePath.html Converts the value into a String. ```rust fn to_string(&self) -> String where T: Display + ?Sized ``` -------------------------------- ### PartialEq Implementation for PathPattern Source: https://docs.rs/archaven/1.1.0/archaven/struct.PathPattern.html Tests for equality between two PathPattern instances. Used by the '==' operator. ```rust fn eq(&self, other: &PathPattern) -> bool ``` -------------------------------- ### Violations::new Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violations.html Creates an empty violation list. ```APIDOC ## Violations::new ### Description Creates an empty violation list. ### Signature ```rust pub fn new() -> Self ``` ``` -------------------------------- ### Access::to_any Source: https://docs.rs/archaven/1.1.0/archaven/struct.Access.html Adds multiple allowed or denied target patterns to an access rule. This is useful for specifying a list of targets. ```APIDOC ## Access::to_any ### Description Adds many allowed or denied target patterns to an access rule. ### Method ```rust pub fn to_any(self, patterns: I) -> Self where I: IntoIterator, S: Into ``` ### Parameters #### Path Parameters - **patterns** (I: IntoIterator, S: Into) - Required - An iterator of target patterns to add to the access rule. ``` -------------------------------- ### Clone Into Source: https://docs.rs/archaven/1.1.0/archaven/struct.ModulePath.html Uses borrowed data to replace owned data, usually by cloning. ```rust fn clone_into(&self, target: &mut T) where T: Clone ``` -------------------------------- ### Compare DependencyGraph for Equality Source: https://docs.rs/archaven/1.1.0/archaven/struct.DependencyGraph.html Tests if two DependencyGraph instances are equal. Equality is based on their contents. ```rust fn eq(&self, other: &DependencyGraph) -> bool ``` -------------------------------- ### Clone to Uninitialized Memory (Nightly) Source: https://docs.rs/archaven/1.1.0/archaven/struct.PrefixMatch.html Performs copy-assignment from self to uninitialized memory. This is an unstable, nightly-only experimental API. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### Adds multiple target patterns to an access rule Source: https://docs.rs/archaven/1.1.0/archaven/struct.Access.html Use `to_any` to efficiently add multiple allowed or denied target patterns to an access rule using an iterator. ```rust pub fn to_any(self, patterns: I) -> Self where I: IntoIterator, S: Into, ``` -------------------------------- ### Clone PrefixMatch Instance Source: https://docs.rs/archaven/1.1.0/archaven/struct.PrefixMatch.html Creates a duplicate of an existing PrefixMatch instance. This is useful for scenarios where you need an independent copy. ```rust fn clone(&self) -> PrefixMatch ``` -------------------------------- ### Rule Checking Source: https://docs.rs/archaven/1.1.0/archaven/struct.Rule.html Method for checking a rule against a dependency graph. ```APIDOC ## Rule Checking ### `check(&self, graph: &DependencyGraph) -> Result` Checks this rule against an already-built dependency graph. #### Errors Returns an error when the rule contains an invalid pattern. ``` -------------------------------- ### Adds a target pattern to an access rule Source: https://docs.rs/archaven/1.1.0/archaven/struct.Access.html Use the `to` function to add a single allowed or denied target pattern to an existing access rule. ```rust pub fn to(self, pattern: impl Into) -> Self ``` -------------------------------- ### Adds a reason to an access rule Source: https://docs.rs/archaven/1.1.0/archaven/struct.Access.html Use the `because` function to attach a human-readable reason to an access rule, which will be used in violation messages. ```rust pub fn because(self, reason: impl Into) -> Self ``` -------------------------------- ### Location::file Source: https://docs.rs/archaven/1.1.0/archaven/struct.Location.html Retrieves the source file path associated with this Location. ```APIDOC ## Location::file ### Description Returns the source file path. ### Signature ```rust pub fn file(&self) -> &Path ``` ``` -------------------------------- ### Check Source Directory for Dependency Violations Source: https://docs.rs/archaven/1.1.0/archaven/struct.Archaven.html Scans a source directory and returns all dependency violations. This function can return an error if the directory cannot be walked, a Rust file cannot be read or parsed, or a configured rule contains an invalid pattern. ```rust pub fn check(&self, root: impl AsRef) -> Result ``` -------------------------------- ### Compare ModulePaths for Equality Source: https://docs.rs/archaven/1.1.0/archaven/struct.ModulePath.html Tests if two ModulePath values are equal. ```rust fn eq(&self, other: &ModulePath) -> bool ``` -------------------------------- ### Attempts to convert a value into another type using TryInto Source: https://docs.rs/archaven/1.1.0/archaven/struct.Access.html Implements `TryInto` for `T` when `U` implements `TryFrom`, providing `try_into` to attempt the conversion. ```rust type Error = >::Error ``` ```rust fn try_into(self) -> Result>::Error> ``` -------------------------------- ### Clone From Another PrefixMatch Source: https://docs.rs/archaven/1.1.0/archaven/struct.PrefixMatch.html Performs copy-assignment from a source PrefixMatch instance to the current one. This is an efficient way to update the value. ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Try Convert Into Another Type Source: https://docs.rs/archaven/1.1.0/archaven/struct.PrefixMatch.html Performs the conversion from `T` to `U`. Returns a `Result` which is `Ok` on success or an `Err` if the conversion fails. ```rust fn try_into(self) -> Result>::Error> ``` -------------------------------- ### Check Rule Against Dependency Graph Source: https://docs.rs/archaven/1.1.0/archaven/struct.Rule.html Executes the defined rule against a pre-built dependency graph to identify any violations. Returns a `Result` containing either the violations or an error if the rule pattern is invalid. ```rust pub fn check( &self, graph: &DependencyGraph, ) -> Result ``` -------------------------------- ### Access::because Source: https://docs.rs/archaven/1.1.0/archaven/struct.Access.html Adds a human-readable reason to an access rule, which can be used in violation messages. ```APIDOC ## Access::because ### Description Adds a human-readable reason used in violation messages. ### Method ```rust pub fn because(self, reason: impl Into) -> Self ``` ### Parameters #### Path Parameters - **reason** (impl Into) - Required - The human-readable reason for the access rule. ``` -------------------------------- ### Compare PrefixMatch for Equality Source: https://docs.rs/archaven/1.1.0/archaven/struct.PrefixMatch.html Tests if two PrefixMatch instances are equal. This is used by the equality operator (==). ```rust fn eq(&self, other: &PrefixMatch) -> bool ``` -------------------------------- ### Create Rule for Dependencies Between Scopes Source: https://docs.rs/archaven/1.1.0/archaven/struct.Rule.html Creates a rule for dependencies that exist between different instances of a specified scope pattern. Useful for managing inter-module dependencies. ```rust pub fn between(scope: impl Into) -> Self ``` -------------------------------- ### DependencyGraph::dependencies Source: https://docs.rs/archaven/1.1.0/archaven/struct.DependencyGraph.html Retrieves all dependencies currently stored in the DependencyGraph in the order they were discovered. This provides a view of the graph's contents. ```APIDOC ## DependencyGraph::dependencies ### Description Returns all dependencies in discovery order. ### Method `dependencies(&self)` ### Returns - `&[Dependency]`: A slice containing all dependencies in discovery order. ``` -------------------------------- ### TryFrom Conversion Source: https://docs.rs/archaven/1.1.0/archaven/struct.ModulePath.html Attempts to convert a value into another type, returning a Result. ```rust fn try_from(value: U) -> Result>::Error> where U: Into ``` -------------------------------- ### Clone DependencyGraph Source: https://docs.rs/archaven/1.1.0/archaven/struct.DependencyGraph.html Creates a deep copy of the DependencyGraph. This is useful for preserving the state of the graph. ```rust fn clone(&self) -> DependencyGraph ``` -------------------------------- ### Format ModulePath for Display Source: https://docs.rs/archaven/1.1.0/archaven/struct.ModulePath.html Formats the ModulePath value for display using the given formatter. ```rust fn fmt(&self, formatter: &mut Formatter<'_>) -> Result ``` -------------------------------- ### Ignore Files by Glob Pattern Source: https://docs.rs/archaven/1.1.0/archaven/struct.Rule.html Ignores dependencies discovered in source files that match the provided glob patterns. Use this to exclude specific files or file types from dependency checks. ```rust pub fn ignore_files(self, patterns: I) -> Self where I: IntoIterator, S: AsRef, ``` -------------------------------- ### Parse Module Path Source: https://docs.rs/archaven/1.1.0/archaven/struct.ModulePath.html Parses a string into a ModulePath. Returns an error if the path is empty or contains empty segments. ```rust pub fn parse(path: &str) -> Result ``` -------------------------------- ### Location::line Source: https://docs.rs/archaven/1.1.0/archaven/struct.Location.html Retrieves the 1-based source line number, if available. ```APIDOC ## Location::line ### Description Returns the 1-based source line, when available. ### Signature ```rust pub fn line(&self) -> Option ``` ``` -------------------------------- ### Create Rule for Dependencies Within a Scope Source: https://docs.rs/archaven/1.1.0/archaven/struct.Rule.html Creates a rule for dependencies that are contained within the same instance of a specified scope pattern. Ideal for intra-module dependency management. ```rust pub fn within(scope: impl Into) -> Self ``` -------------------------------- ### To Owned Source: https://docs.rs/archaven/1.1.0/archaven/struct.ModulePath.html Creates owned data from borrowed data, usually by cloning. ```rust fn to_owned(&self) -> T where T: Clone ``` -------------------------------- ### Clone SourceDirectory Source: https://docs.rs/archaven/1.1.0/archaven/struct.SourceDirectory.html Creates a duplicate of the SourceDirectory value. This is a standard implementation for the Clone trait. ```rust fn clone(&self) -> SourceDirectory ``` -------------------------------- ### Into Conversion Source: https://docs.rs/archaven/1.1.0/archaven/struct.ModulePath.html Converts a value into another type using the From trait implementation. ```rust fn into(self) -> U where U: From ``` -------------------------------- ### TryFrom Trait Implementation for Archaven Source: https://docs.rs/archaven/1.1.0/archaven/struct.Archaven.html Implementation of the `TryFrom` trait for Archaven, allowing fallible conversion from another type. ```rust type Error = Infallible fn try_from(value: U) -> Result>::Error> ``` -------------------------------- ### SourceDirectory Struct Definition Source: https://docs.rs/archaven/1.1.0/archaven/struct.SourceDirectory.html Defines the SourceDirectory struct, which is used to represent a discovered Rust source directory. It contains private fields. ```rust pub struct SourceDirectory { /* private fields */ } ``` -------------------------------- ### Compare Location for Equality Source: https://docs.rs/archaven/1.1.0/archaven/struct.Location.html Tests if two Location values are equal. This is part of the PartialEq trait implementation. ```rust fn eq(&self, other: &Location) -> bool ``` -------------------------------- ### Add Explicitly Denied Access Source: https://docs.rs/archaven/1.1.0/archaven/struct.Rule.html Adds an explicit denial for a specific access pattern. This is useful for prohibiting certain types of dependencies even if they might otherwise be permitted. ```rust pub fn deny(self, access: Access) -> Self ``` -------------------------------- ### Convert From a Value Source: https://docs.rs/archaven/1.1.0/archaven/struct.PrefixMatch.html Returns the argument unchanged. This is part of the `From` trait implementation. ```rust fn from(t: T) -> T ``` -------------------------------- ### Default Implementation for Archaven Source: https://docs.rs/archaven/1.1.0/archaven/struct.Archaven.html Provides the default value for the Archaven type. ```rust fn default() -> Archaven ``` -------------------------------- ### Clone Implementation for PathPattern Source: https://docs.rs/archaven/1.1.0/archaven/struct.PathPattern.html Provides the ability to duplicate PathPattern values. This is a standard trait implementation. ```rust fn clone(&self) -> PathPattern ``` -------------------------------- ### TryInto Trait Implementation for Archaven Source: https://docs.rs/archaven/1.1.0/archaven/struct.Archaven.html Implementation of the `TryInto` trait for Archaven, allowing fallible conversion into another type. ```rust type Error = >::Error fn try_into(self) -> Result>::Error> ``` -------------------------------- ### PathPattern::parse Source: https://docs.rs/archaven/1.1.0/archaven/struct.PathPattern.html Parses a string into a PathPattern. Supports '*' for single segment matching and '**' for multi-segment matching. ```APIDOC ## PathPattern::parse ### Description Parses a path pattern such as `app::*::domain::**`. ### Method `pub fn parse(pattern: &str) -> Result` ### Parameters #### Path Parameters - **pattern** (`&str`) - The string pattern to parse. ### Errors Returns an error when the pattern is empty, contains empty segments, or uses `*` inside a literal segment. ``` -------------------------------- ### Archaven Struct Definition Source: https://docs.rs/archaven/1.1.0/archaven/struct.Archaven.html Defines the Archaven struct, which serves as the entry point for scanning Rust source files and checking dependency rules. It has private fields. ```rust pub struct Archaven { /* private fields */ } ``` -------------------------------- ### Hash Slice of ModulePaths Source: https://docs.rs/archaven/1.1.0/archaven/struct.ModulePath.html Feeds a slice of ModulePath values into a given Hasher. ```rust fn hash_slice(data: &[Self], state: &mut H) where H: Hasher, Self: Sized, ``` -------------------------------- ### Clone ModulePath Source: https://docs.rs/archaven/1.1.0/archaven/struct.ModulePath.html Creates a duplicate of the ModulePath value. ```rust fn clone(&self) -> ModulePath ``` -------------------------------- ### Violations::assert_empty Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violations.html Panics if any violations exist in the list. ```APIDOC ## Violations::assert_empty ### Description Panics when any violation exists. ### Panics Panics with the formatted violation list when the collection is not empty. ### Signature ```rust pub fn assert_empty(&self) ``` ``` -------------------------------- ### Location::column Source: https://docs.rs/archaven/1.1.0/archaven/struct.Location.html Retrieves the 1-based source column number, if available. ```APIDOC ## Location::column ### Description Returns the 1-based source column, when available. ### Signature ```rust pub fn column(&self) -> Option ``` ``` -------------------------------- ### Add Allowed Access Exception Source: https://docs.rs/archaven/1.1.0/archaven/struct.Rule.html Adds an exception to the rule, allowing a specific type of access. This is used in conjunction with `deny_all` or to permit specific interactions. ```rust pub fn allow(self, access: Access) -> Self ``` -------------------------------- ### Hash ModulePath Source: https://docs.rs/archaven/1.1.0/archaven/struct.ModulePath.html Feeds the ModulePath value into a given Hasher. ```rust fn hash<__H: Hasher>(&self, state: &mut __H) ``` -------------------------------- ### Parse Path Pattern Source: https://docs.rs/archaven/1.1.0/archaven/struct.PathPattern.html Parses a string into a PathPattern. Returns an error for empty patterns, empty segments, or '*' within literal segments. ```rust pub fn parse(pattern: &str) -> Result ``` -------------------------------- ### RuleSet Check Method Source: https://docs.rs/archaven/1.1.0/archaven/trait.RuleSet.html The `check` method is required by the `RuleSet` trait. It takes a `DependencyGraph` and returns a `Result` containing either `Violations` or an `ArchavenError` if the configuration is invalid. ```rust fn check( &self, graph: &DependencyGraph, ) -> Result ``` -------------------------------- ### Attempts to convert a value into another type Source: https://docs.rs/archaven/1.1.0/archaven/struct.Access.html Implements `TryFrom` for `T` when `U` implements `Into`, providing `try_from` to attempt the conversion. ```rust type Error = Infallible ``` ```rust fn try_from(value: U) -> Result>::Error> ``` -------------------------------- ### Ignore Module Root Files Source: https://docs.rs/archaven/1.1.0/archaven/struct.Rule.html Configures the rule to ignore dependencies found in standard Rust module root files (`mod.rs`, `lib.rs`, etc.). This helps in focusing on dependencies within the main code structure. ```rust pub fn ignore_module_roots(self) -> Self ``` -------------------------------- ### Format PrefixMatch for Debugging Source: https://docs.rs/archaven/1.1.0/archaven/struct.PrefixMatch.html Formats the PrefixMatch value for debugging purposes using the provided formatter. This helps in inspecting the struct's contents. ```rust fn fmt(&self, f: &mut Formatter<'_>) -> Result ``` -------------------------------- ### Compare Violations for Equality Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violations.html Tests if two `Violations` collections are equal. Equality is determined by having the same set of violations. ```rust fn eq(&self, other: &Violations) -> bool ``` -------------------------------- ### Access::except_to Source: https://docs.rs/archaven/1.1.0/archaven/struct.Access.html Excludes specific target patterns from an access rule. This is useful for creating exceptions to broader rules. ```APIDOC ## Access::except_to ### Description Excludes target patterns from this access match. This is useful for explicit denies with a narrow exception. ### Method ```rust pub fn except_to(self, patterns: I) -> Self where I: IntoIterator, S: Into ``` ### Parameters #### Path Parameters - **patterns** (I: IntoIterator, S: Into) - Required - An iterator of target patterns to exclude from the access rule. ``` -------------------------------- ### DependencyGraph::push Source: https://docs.rs/archaven/1.1.0/archaven/struct.DependencyGraph.html Adds a single dependency to an existing DependencyGraph. This method allows for incremental building of the graph. ```APIDOC ## DependencyGraph::push ### Description Adds one dependency to the graph. ### Method `push(&mut self, dependency: Dependency)` ### Parameters #### Path Parameters - `dependency` (Dependency): The dependency to add to the graph. ### Returns - `()`: This method does not return a value. ``` -------------------------------- ### Violations::extend Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violations.html Appends another violation list to the current one. ```APIDOC ## Violations::extend ### Description Appends another violation list. ### Signature ```rust pub fn extend(&mut self, other: Self) ``` ``` -------------------------------- ### Convert Into Another Type Source: https://docs.rs/archaven/1.1.0/archaven/struct.PrefixMatch.html Calls `U::from(self)` to perform the conversion. The behavior depends on the `From for U` implementation. ```rust fn into(self) -> U ``` -------------------------------- ### Clone Location Instance Source: https://docs.rs/archaven/1.1.0/archaven/struct.Location.html Returns a duplicate of the Location value. This is part of the Clone trait implementation. ```rust fn clone(&self) -> Location ``` -------------------------------- ### Clone Dependency Source: https://docs.rs/archaven/1.1.0/archaven/struct.Dependency.html Creates a duplicate of the `Dependency` value. This is part of the `Clone` trait implementation. ```rust fn clone(&self) -> Dependency ``` -------------------------------- ### Access Struct Definition Source: https://docs.rs/archaven/1.1.0/archaven/struct.Access.html Defines the Access struct, which holds private fields to describe dependency access rules. ```rust pub struct Access { /* private fields */ } ``` -------------------------------- ### Archaven::rule Source: https://docs.rs/archaven/1.1.0/archaven/struct.Archaven.html Adds a rule set to the Archaven checker. This method is chainable. ```APIDOC ## Archaven::rule ### Description Adds a rule set to the checker. ### Method `pub fn rule(self, rule: R) -> Self` ### Type Parameters * `R`: Must implement `RuleSet` and `'static`. ``` -------------------------------- ### Excludes target patterns from an access rule Source: https://docs.rs/archaven/1.1.0/archaven/struct.Access.html Use `except_to` to exclude specific target patterns from an access rule, useful for explicit denies with narrow exceptions. ```rust pub fn except_to(self, patterns: I) -> Self where I: IntoIterator, S: Into, ``` -------------------------------- ### Violation Struct Methods Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violation.html Provides access to details of a dependency rule violation. ```APIDOC ## Struct Violation One dependency rule violation. ### Methods #### `rule_name(&self) -> &str` Returns the rule name. #### `reason(&self) -> &str` Returns the violation reason. #### `source(&self) -> &ModulePath` Returns the dependency source. #### `target(&self) -> &ModulePath` Returns the dependency target. #### `location(&self) -> &Location` Returns the source location. ``` -------------------------------- ### Allow Only Module Root Files Source: https://docs.rs/archaven/1.1.0/archaven/struct.Rule.html Restricts the rule to only consider dependencies originating from Rust module root files within matching directories. This enforces a specific module organization. ```rust pub fn allow_only_module_roots(self) -> Self ``` -------------------------------- ### PathPattern Struct Definition Source: https://docs.rs/archaven/1.1.0/archaven/struct.PathPattern.html Defines the PathPattern struct used for matching Rust module paths. It has private fields. ```rust pub struct PathPattern { /* private fields */ } ``` -------------------------------- ### Clones an Access value Source: https://docs.rs/archaven/1.1.0/archaven/struct.Access.html Implements the `Clone` trait for `Access`, allowing for the creation of duplicate values. ```rust fn clone(&self) -> Access ``` -------------------------------- ### Add RuleSet to Archaven Source: https://docs.rs/archaven/1.1.0/archaven/struct.Archaven.html Adds a rule set to the Archaven checker. The rule set must implement the `RuleSet` trait and have a static lifetime. ```rust pub fn rule(self, rule: R) -> Self where R: RuleSet + 'static, ``` -------------------------------- ### Rule Struct Definition Source: https://docs.rs/archaven/1.1.0/archaven/struct.Rule.html Defines the structure of a dependency rule. This struct contains private fields and is used to configure dependency checking. ```rust pub struct Rule { /* private fields */ } ``` -------------------------------- ### Set Rule Name Source: https://docs.rs/archaven/1.1.0/archaven/struct.Rule.html Assigns a human-readable name to the rule. This is helpful for identifying the rule in reports or error messages. ```rust pub fn named(self, name: impl Into) -> Self ``` -------------------------------- ### Define Struct Location Source: https://docs.rs/archaven/1.1.0/archaven/struct.Location.html Defines the Location struct with private fields. This struct is used to represent source locations. ```rust pub struct Location { /* private fields */ } ``` -------------------------------- ### PrefixMatch Struct Definition Source: https://docs.rs/archaven/1.1.0/archaven/struct.PrefixMatch.html Defines the PrefixMatch struct. It has private fields and is used to store the result of a prefix match operation. ```rust pub struct PrefixMatch { /* private fields */ } ``` -------------------------------- ### Dependency Struct Definition Source: https://docs.rs/archaven/1.1.0/archaven/struct.Dependency.html Defines the structure of a dependency between Rust modules. It contains private fields. ```rust pub struct Dependency { /* private fields */ } ``` -------------------------------- ### Clone Violation Instance Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violation.html Creates a duplicate of a Violation instance. This is useful when you need to work with a copy of the violation data. ```rust fn clone(&self) -> Violation ``` -------------------------------- ### ToOwned Implementation Source: https://docs.rs/archaven/1.1.0/archaven/struct.PathPattern.html Creates owned data from borrowed data, typically by cloning. Requires the Clone trait. ```rust type Owned = T ``` ```rust fn to_owned(&self) -> T ``` ```rust fn clone_into(&self, target: &mut T) ``` -------------------------------- ### Violations::is_empty Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violations.html Checks if the violation list is empty. ```APIDOC ## Violations::is_empty ### Description Returns `true` when there are no violations. ### Signature ```rust pub fn is_empty(&self) -> bool ``` ``` -------------------------------- ### Convert Violations to a Vector Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violations.html Consumes the Violations collection and converts it into a `Vec`. This is useful when you need ownership of the violations. ```rust pub fn into_vec(self) -> Vec ``` -------------------------------- ### Violations::len Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violations.html Returns the number of violations in the list. ```APIDOC ## Violations::len ### Description Returns the number of violations. ### Signature ```rust pub fn len(&self) -> usize ``` ``` -------------------------------- ### ModulePath Struct Definition Source: https://docs.rs/archaven/1.1.0/archaven/struct.ModulePath.html Defines the ModulePath struct, which holds a Rust module path split into '::'-separated segments. It has private fields. ```rust pub struct ModulePath { /* private fields */ } ``` -------------------------------- ### Iterate Over Violations Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violations.html Provides an iterator over the violations in the collection. Each item yielded is a reference to a `Violation`. ```rust pub fn iter(&self) -> impl Iterator ``` -------------------------------- ### Add Dependency to Graph Source: https://docs.rs/archaven/1.1.0/archaven/struct.DependencyGraph.html Appends a single dependency to an existing DependencyGraph. This method modifies the graph in place. ```rust pub fn push(&mut self, dependency: Dependency) ``` -------------------------------- ### Equality Check for Violation Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violation.html Tests if two Violation instances are equal. This is used by the equality operator (==). ```rust fn eq(&self, other: &Violation) -> bool ``` -------------------------------- ### Create Owned Data Source: https://docs.rs/archaven/1.1.0/archaven/struct.PrefixMatch.html Creates owned data from borrowed data, usually by cloning. This is part of the `ToOwned` trait. ```rust fn to_owned(&self) -> T ``` -------------------------------- ### Clone Violations Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violations.html Creates a duplicate of the Violations collection. This allows for independent manipulation of violation lists. ```rust fn clone(&self) -> Violations ``` -------------------------------- ### Violations::iter Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violations.html Provides an iterator over the violations. ```APIDOC ## Violations::iter ### Description Iterates over violations. ### Signature ```rust pub fn iter(&self) -> impl Iterator ``` ``` -------------------------------- ### Append Another Violation List Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violations.html Appends all violations from another Violations instance to the current one. This is useful for merging violation collections. ```rust pub fn extend(&mut self, other: Self) ``` -------------------------------- ### Struct Definition: DependencyGraph Source: https://docs.rs/archaven/1.1.0/archaven/struct.DependencyGraph.html Defines the structure of the DependencyGraph. It is a private struct, meaning its internal fields are not directly accessible. ```rust pub struct DependencyGraph { /* private fields */ } ``` -------------------------------- ### Borrow Immutably Source: https://docs.rs/archaven/1.1.0/archaven/struct.PrefixMatch.html Immutably borrows the value. This is part of the `Borrow` trait implementation. ```rust fn borrow(&self) -> &T ``` -------------------------------- ### Assert No Violations Exist Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violations.html Panics if the Violations collection is not empty. This is a common assertion in tests to ensure no violations occurred. ```rust pub fn assert_empty(&self) ``` -------------------------------- ### Check if Violation List is Empty Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violations.html Returns true if the Violations collection contains no violations, and false otherwise. Useful for conditional logic. ```rust pub fn is_empty(&self) -> bool ``` -------------------------------- ### Clone Into Existing Owned Data Source: https://docs.rs/archaven/1.1.0/archaven/struct.PrefixMatch.html Uses borrowed data to replace owned data, usually by cloning. This is part of the `ToOwned` trait. ```rust fn clone_into(&self, target: &mut T) ``` -------------------------------- ### Default Violations Instance Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violations.html Provides the default value for the Violations type, which is an empty collection. This is part of the `Default` trait implementation. ```rust fn default() -> Violations ``` -------------------------------- ### Violations::into_vec Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violations.html Converts the violation collection into a vector. ```APIDOC ## Violations::into_vec ### Description Converts this collection into a vector. ### Signature ```rust pub fn into_vec(self) -> Vec ``` ``` -------------------------------- ### Create Iterator for Borrowed Violations Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violations.html Creates an iterator over references to `Violation` items within a borrowed `Violations` collection. This is part of the `IntoIterator` trait for references. ```rust fn into_iter(self) -> Self::IntoIter ``` -------------------------------- ### Violation Struct Definition Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violation.html Defines the structure of a dependency rule violation. It contains private fields. ```rust pub struct Violation { /* private fields */ } ``` -------------------------------- ### ArchavenError Enum Definition Source: https://docs.rs/archaven/1.1.0/archaven/enum.ArchavenError.html Defines the possible errors that can be returned by Archaven during analysis. Each variant includes relevant data for diagnosing the error. ```rust pub enum ArchavenError { InvalidPattern { pattern: String, message: String, }, InvalidRule { rule: String, message: String, }, WalkDir { path: PathBuf, source: Error, }, ReadFile { path: PathBuf, source: Error, }, ParseFile { path: PathBuf, source: Error, }, } ``` -------------------------------- ### Borrow Mutably Source: https://docs.rs/archaven/1.1.0/archaven/struct.PrefixMatch.html Mutably borrows the value. This is part of the `BorrowMut` trait implementation. ```rust fn borrow_mut(&mut self) -> &mut T ``` -------------------------------- ### Define Violations Struct Source: https://docs.rs/archaven/1.1.0/archaven/struct.Violations.html Defines the Violations struct, which is used to collect dependency rule violations. It has private fields. ```rust pub struct Violations { /* private fields */ } ``` -------------------------------- ### RuleSet Trait Definition Source: https://docs.rs/archaven/1.1.0/archaven/trait.RuleSet.html Defines the `RuleSet` trait with a required `check` method. This trait is used to create custom dependency rule sets. ```rust pub trait RuleSet { // Required method fn check( &self, graph: &DependencyGraph, ) -> Result; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.