Trait Rule

Source
pub trait Rule: Default {
    const NAME: &'static str;
    const LEVEL: Level;

    // Required methods
    fn message(&self, message: &Message) -> String;
    fn validate(&self, message: &Message) -> Option<Violation>;
}
Expand description

Rule trait represents a rule that can be applied to a text.

Required Associated Constants§

Source

const NAME: &'static str

The name of the rule. Note that it should be unique

Source

const LEVEL: Level

The level of the rule.

Required Methods§

Source

fn message(&self, message: &Message) -> String

The message to display when the rule fails.

Source

fn validate(&self, message: &Message) -> Option<Violation>

Validate the given text.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Rule for BodyEmpty

BodyEmpty represents the body-empty rule.

Source§

const NAME: &'static str = "body-empty"

Source§

const LEVEL: Level = Level::Error

Source§

impl Rule for BodyMaxLength

BodyMaxLength represents the body-max-length rule.

Source§

const NAME: &'static str = "body-max-length"

Source§

const LEVEL: Level = Level::Error

Source§

impl Rule for DescriptionEmpty

DescriptionEmpty represents the description-empty rule.

Source§

const NAME: &'static str = "description-empty"

Source§

const LEVEL: Level = Level::Error

Source§

impl Rule for DescriptionFormat

DescriptionFormat represents the description-format rule.

Source§

const NAME: &'static str = "description-format"

Source§

const LEVEL: Level = Level::Error

Source§

impl Rule for DescriptionMaxLength

DescriptionMaxLength represents the description-max-length rule.

Source§

const NAME: &'static str = "description-max-length"

Source§

const LEVEL: Level = Level::Error

Source§

impl Rule for FootersEmpty

FooterEmpty represents the footer-empty rule.

Source§

const NAME: &'static str = "footers-empty"

Source§

const LEVEL: Level = Level::Error

Source§

impl Rule for Scope

Scope represents the scope rule.

Source§

const NAME: &'static str = "scope"

Source§

const LEVEL: Level = Level::Error

Source§

impl Rule for ScopeEmpty

ScopeEmpty represents the scope-empty rule.

Source§

const NAME: &'static str = "scope-empty"

Source§

const LEVEL: Level = Level::Error

Source§

impl Rule for ScopeFormat

ScopeFormat represents the scope-format rule.

Source§

const NAME: &'static str = "scope-format"

Source§

const LEVEL: Level = Level::Error

Source§

impl Rule for ScopeMaxLength

ScopeMaxLength represents the scope-max-length rule.

Source§

const NAME: &'static str = "scope-max-length"

Source§

const LEVEL: Level = Level::Error

Source§

impl Rule for SubjectEmpty

SubjectEmpty represents the subject-empty rule.

Source§

const NAME: &'static str = "subject-empty"

Source§

const LEVEL: Level = Level::Error

Source§

impl Rule for Type

Type represents the type rule.

Source§

const NAME: &'static str = "type"

Source§

const LEVEL: Level = Level::Error

Source§

impl Rule for TypeEmpty

TypeEmpty represents the type-empty rule.

Source§

const NAME: &'static str = "type-empty"

Source§

const LEVEL: Level = Level::Error

Source§

impl Rule for TypeFormat

TypeFormat represents the type-format rule.

Source§

const NAME: &'static str = "type-format"

Source§

const LEVEL: Level = Level::Error

Source§

impl Rule for TypeMaxLength

TypeMaxLength represents the type-max-length rule.

Source§

const NAME: &'static str = "type-max-length"

Source§

const LEVEL: Level = Level::Error