Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Derive Debug for Rule #6

Merged
merged 2 commits into from
Jan 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions rust/src/enhancers/rules.rs
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
use std::fmt;
use std::sync::Arc;

use super::actions::Action;
use super::frame::Frame;
use super::matchers::{ExceptionMatcher, FrameMatcher};
use super::ExceptionData;

#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct Rule(pub(crate) Arc<RuleInner>);

#[derive(Debug, Clone)]
pub struct RuleInner {
pub frame_matchers: Vec<FrameMatcher>,
pub exception_matchers: Vec<ExceptionMatcher>,
pub actions: Vec<Action>,
}

impl fmt::Debug for Rule {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Rule")
.field("frame_matchers", &self.0.frame_matchers.len())
.field("exception_matchers", &self.0.exception_matchers.len())
.field("actions", &self.0.actions)
.finish()
}
}

impl Rule {
pub fn matches_exception(&self, exception_data: &ExceptionData) -> bool {
self.0
Expand Down
Loading