#[non_exhaustive]pub struct MetricsCfg {
pub path: PathBuf,
pub options: MetricsOptions,
}Expand description
Configuration options for computing the metrics of a code.
Marked #[non_exhaustive] so future config fields can land
additively. Downstream callers must construct via the builder
methods rather than struct-literal syntax (rustc rejects external
struct literals on non-exhaustive types with E0639, including the
..Default::default() spread form).
use std::path::PathBuf;
use big_code_analysis::{MetricsCfg, MetricsOptions};
let cfg = MetricsCfg::new(PathBuf::from("lib.rs"))
.with_options(MetricsOptions::default().with_exclude_tests(true));Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.path: PathBufPath to the file containing the code
options: MetricsOptionsPer-traversal options forwarded to [metrics_with_options].
Implementations§
Source§impl MetricsCfg
impl MetricsCfg
Sourcepub fn new(path: PathBuf) -> Self
pub fn new(path: PathBuf) -> Self
Build a MetricsCfg for path with default options. Chain
MetricsCfg::with_options to override the per-traversal
flags. Required because MetricsCfg is #[non_exhaustive] —
downstream crates cannot use the struct-literal form.
Sourcepub fn with_options(self, options: MetricsOptions) -> Self
pub fn with_options(self, options: MetricsOptions) -> Self
Builder-style setter for MetricsCfg::options.
Trait Implementations§
Source§impl Debug for MetricsCfg
impl Debug for MetricsCfg
Source§impl Default for MetricsCfg
impl Default for MetricsCfg
Source§fn default() -> MetricsCfg
fn default() -> MetricsCfg
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MetricsCfg
impl RefUnwindSafe for MetricsCfg
impl Send for MetricsCfg
impl Sync for MetricsCfg
impl Unpin for MetricsCfg
impl UnsafeUnpin for MetricsCfg
impl UnwindSafe for MetricsCfg
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