pub struct PproxyRuleFile {
pub path: PathBuf,
pub entries: Vec<PproxyRuleEntry>,
pub diagnostics: Vec<RuleDiagnostic>,
}Expand description
A loaded pproxy rule file with parsed entries and diagnostics.
Fields§
§path: PathBufPath to the rule file.
entries: Vec<PproxyRuleEntry>Parsed and compiled rule entries.
diagnostics: Vec<RuleDiagnostic>Diagnostics produced during loading.
Implementations§
Source§impl PproxyRuleFile
impl PproxyRuleFile
Sourcepub fn load(path: &Path) -> Result<Self, RegexCompileError>
pub fn load(path: &Path) -> Result<Self, RegexCompileError>
Load and parse a pproxy-style rule file.
Rule file format:
- Lines starting with
#are comments (ignored). - Empty lines are ignored.
- Every other line is a regular-expression alternative.
This matches pproxy 2.7.9’s compile_rule: it joins non-comment,
non-empty lines into one expression. The pattern -> action syntax is
accepted as an extension for older Eggress files, but is not a pproxy
rule-file format and therefore remains a diagnostic rather than a
routing action.
Sourcepub fn matches_host(&self, hostname: &str) -> Result<bool, RegexMatchError>
pub fn matches_host(&self, hostname: &str) -> Result<bool, RegexMatchError>
Match a hostname against all rules in the file.
Returns true if any rule matches the hostname (first-match-wins semantics).
Sourcepub fn errors(&self) -> Vec<&RuleDiagnostic>
pub fn errors(&self) -> Vec<&RuleDiagnostic>
Return only the error-level diagnostics.
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Return true if there are any error-level diagnostics.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PproxyRuleFile
impl RefUnwindSafe for PproxyRuleFile
impl Send for PproxyRuleFile
impl Sync for PproxyRuleFile
impl Unpin for PproxyRuleFile
impl UnsafeUnpin for PproxyRuleFile
impl UnwindSafe for PproxyRuleFile
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