Skip to main content

RulesText

Trait RulesText 

Source
pub trait RulesText:
    Clone
    + Debug
    + PartialEq
    + Serialize
    + DeserializeOwned
    + Send
    + Sync
    + 'static {
    const KIND: &'static str;
    const ONE: &'static str;

    // Required methods
    fn name(&self) -> &str;
    fn source(&self) -> &str;
    fn edition(&self) -> Option<Edition>;
    fn validate(&self) -> Result<(), RulesTextError>;
}
Expand description

Something kept as rules text: what it’s called and where it’s from.

Required Associated Constants§

Source

const KIND: &'static str

What’s stored in the kind column, and the API’s path: spells.

Source

const ONE: &'static str

One of them, in words: spell.

Required Methods§

Source

fn name(&self) -> &str

What it’s called.

Source

fn source(&self) -> &str

Where it’s from: “SRD 5.2”, “Homebrew”.

Source

fn edition(&self) -> Option<Edition>

The rules it’s written for; None suits either.

Source

fn validate(&self) -> Result<(), RulesTextError>

Checks it can be kept.

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 RulesText for ConditionText

Source§

const KIND: &'static str = "conditions"

Source§

const ONE: &'static str = "condition"

Source§

impl RulesText for SpellText

Source§

const KIND: &'static str = "spells"

Source§

const ONE: &'static str = "spell"