pub struct RestrictiveValidator {
pub reserved_prefixes: Vec<String>,
pub max_levels: Option<usize>,
pub max_topic_length: Option<usize>,
pub prohibited_chars: Vec<char>,
}Expand description
Restrictive validator with additional constraints
This validator extends the standard MQTT rules with additional restrictions such as reserved topic prefixes, maximum topic levels, and custom character sets.
Fields§
§reserved_prefixes: Vec<String>Reserved topic prefixes that should be rejected
max_levels: Option<usize>Maximum number of topic levels (separated by ‘/’)
max_topic_length: Option<usize>Maximum topic length (overrides MQTT spec if smaller)
prohibited_chars: Vec<char>Prohibited characters beyond MQTT spec requirements
Implementations§
Source§impl RestrictiveValidator
impl RestrictiveValidator
Sourcepub fn with_reserved_prefix(self, prefix: impl Into<String>) -> Self
pub fn with_reserved_prefix(self, prefix: impl Into<String>) -> Self
Adds a reserved topic prefix
Sourcepub fn with_max_levels(self, max_levels: usize) -> Self
pub fn with_max_levels(self, max_levels: usize) -> Self
Sets the maximum number of topic levels
Sourcepub fn with_max_topic_length(self, max_length: usize) -> Self
pub fn with_max_topic_length(self, max_length: usize) -> Self
Sets the maximum topic length
Sourcepub fn with_prohibited_char(self, ch: char) -> Self
pub fn with_prohibited_char(self, ch: char) -> Self
Adds a prohibited character
Trait Implementations§
Source§impl Clone for RestrictiveValidator
impl Clone for RestrictiveValidator
Source§fn clone(&self) -> RestrictiveValidator
fn clone(&self) -> RestrictiveValidator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RestrictiveValidator
impl Debug for RestrictiveValidator
Source§impl Default for RestrictiveValidator
impl Default for RestrictiveValidator
Source§fn default() -> RestrictiveValidator
fn default() -> RestrictiveValidator
Returns the “default value” for a type. Read more
Source§impl TopicValidator for RestrictiveValidator
impl TopicValidator for RestrictiveValidator
Source§fn validate_topic_name(&self, topic: &str) -> Result<()>
fn validate_topic_name(&self, topic: &str) -> Result<()>
Validates a topic name for publishing Read more
Source§fn validate_topic_filter(&self, filter: &str) -> Result<()>
fn validate_topic_filter(&self, filter: &str) -> Result<()>
Validates a topic filter for subscriptions Read more
Source§fn is_reserved_topic(&self, topic: &str) -> bool
fn is_reserved_topic(&self, topic: &str) -> bool
Checks if a topic is reserved and should be restricted Read more
Source§fn description(&self) -> &'static str
fn description(&self) -> &'static str
Gets a human-readable description of the validator
Auto Trait Implementations§
impl Freeze for RestrictiveValidator
impl RefUnwindSafe for RestrictiveValidator
impl Send for RestrictiveValidator
impl Sync for RestrictiveValidator
impl Unpin for RestrictiveValidator
impl UnwindSafe for RestrictiveValidator
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