pub struct DetectorRegistry { /* private fields */ }Expand description
Detector registry for managing multiple detectors
Provides functionality to register, unregister, and run detectors.
Implementations§
Source§impl DetectorRegistry
impl DetectorRegistry
Sourcepub fn register(&mut self, detector: Box<dyn Detector>)
pub fn register(&mut self, detector: Box<dyn Detector>)
Register a detector
§Arguments
detector- Boxed detector to register
§Example
use memscope_rs::analysis::detectors::{DetectorRegistry, LeakDetector, LeakDetectorConfig};
let mut registry = DetectorRegistry::new();
let detector = LeakDetector::new(LeakDetectorConfig::default());
registry.register(Box::new(detector));Sourcepub fn unregister(&mut self, name: &str) -> bool
pub fn unregister(&mut self, name: &str) -> bool
Sourcepub fn get_detector(&self, name: &str) -> Option<&dyn Detector>
pub fn get_detector(&self, name: &str) -> Option<&dyn Detector>
Sourcepub fn run_all(&self, allocations: &[AllocationInfo]) -> Vec<DetectionResult>
pub fn run_all(&self, allocations: &[AllocationInfo]) -> Vec<DetectionResult>
Run all registered detectors
§Arguments
allocations- Allocations to analyze
§Returns
Vector of detection results from all detectors.
§Example
ⓘ
use memscope_rs::analysis::detectors::DetectorRegistry;
fn run_all_analysis(registry: &DetectorRegistry, allocations: &[AllocationInfo]) {
let results = registry.run_all(allocations);
for result in results {
println!("{} found {} issues", result.detector_name, result.issues.len());
}
}Sourcepub fn run_detector(
&self,
name: &str,
allocations: &[AllocationInfo],
) -> Option<DetectionResult>
pub fn run_detector( &self, name: &str, allocations: &[AllocationInfo], ) -> Option<DetectionResult>
Sourcepub fn detector_names(&self) -> Vec<&str>
pub fn detector_names(&self) -> Vec<&str>
Trait Implementations§
Source§impl Debug for DetectorRegistry
impl Debug for DetectorRegistry
Source§impl Default for DetectorRegistry
impl Default for DetectorRegistry
Source§fn default() -> DetectorRegistry
fn default() -> DetectorRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for DetectorRegistry
impl !UnwindSafe for DetectorRegistry
impl Freeze for DetectorRegistry
impl Send for DetectorRegistry
impl Sync for DetectorRegistry
impl Unpin for DetectorRegistry
impl UnsafeUnpin for DetectorRegistry
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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