pub struct Spellcasting {
pub spells: Vec<Spell>,
pub slots: BTreeMap<u8, Pool>,
pub pact_magic: Option<PactMagic>,
}Expand description
Everything about a character’s spellcasting. Empty for non-casters.
Fields§
§spells: Vec<Spell>§slots: BTreeMap<u8, Pool>Regular spell slots keyed by slot level (1-9). Recover on a long rest.
pact_magic: Option<PactMagic>Warlock Pact Magic slots. Recover on a short or long rest.
Implementations§
Source§impl Spellcasting
impl Spellcasting
Sourcepub const MAX_SPELL_LEVEL: u8 = 9
pub const MAX_SPELL_LEVEL: u8 = 9
The highest level of a spell slot.
Sourcepub const MAX_PACT_LEVEL: u8 = 5
pub const MAX_PACT_LEVEL: u8 = 5
The highest level of a pact slot.
Sourcepub fn find_spell(&self, name: &str) -> Option<&Spell>
pub fn find_spell(&self, name: &str) -> Option<&Spell>
The spell called name (any case), if the character has it.
Sourcepub fn validate(&self) -> Result<(), ValidationError>
pub fn validate(&self) -> Result<(), ValidationError>
Checks the spells’ names and levels, and the slots’ levels and counts.
Trait Implementations§
Source§impl Clone for Spellcasting
impl Clone for Spellcasting
Source§fn clone(&self) -> Spellcasting
fn clone(&self) -> Spellcasting
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ComposeSchema for Spellcasting
impl ComposeSchema for Spellcasting
Source§impl Debug for Spellcasting
impl Debug for Spellcasting
Source§impl Default for Spellcasting
impl Default for Spellcasting
Source§fn default() -> Spellcasting
fn default() -> Spellcasting
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for Spellcastingwhere
Spellcasting: Default,
impl<'de> Deserialize<'de> for Spellcastingwhere
Spellcasting: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for Spellcasting
impl PartialEq for Spellcasting
Source§fn eq(&self, other: &Spellcasting) -> bool
fn eq(&self, other: &Spellcasting) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for Spellcasting
impl Serialize for Spellcasting
Source§impl ToSchema for Spellcasting
impl ToSchema for Spellcasting
impl Eq for Spellcasting
impl StructuralPartialEq for Spellcasting
Auto Trait Implementations§
impl Freeze for Spellcasting
impl RefUnwindSafe for Spellcasting
impl Send for Spellcasting
impl Sync for Spellcasting
impl Unpin for Spellcasting
impl UnsafeUnpin for Spellcasting
impl UnwindSafe for Spellcasting
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.