pub struct Character {Show 15 fields
pub classes: Classes,
pub name: String,
pub age: u16,
pub race_index: String,
pub subrace_index: String,
pub alignment_index: String,
pub description: String,
pub background_index: String,
pub background_description: String,
pub money: u32,
pub abilities_score: Abilities,
pub hp: u16,
pub max_hp: u16,
pub inventory: HashMap<String, u16>,
pub other: Vec<String>,
/* private fields */
}Fields§
§classes: ClassesIndexes from https://www.dnd5eapi.co/api/classes/
name: String§age: u16§race_index: StringIndex from https://www.dnd5eapi.co/api/races/
subrace_index: StringIndex from https://www.dnd5eapi.co/api/subraces/
alignment_index: StringIndex from https://www.dnd5eapi.co/api/alignments/
description: StringPhysical description
background_index: StringIndex from https://www.dnd5eapi.co/api/backgrounds/
background_description: StringBackground description
money: u32§abilities_score: Abilities§hp: u16§max_hp: u16§inventory: HashMap<String, u16>§other: Vec<String>Implementations§
source§impl Character
impl Character
pub async fn get_spellcasting_slots( &self, ) -> Result<HashMap<String, LevelSpellcasting>, ApiError>
pub async fn get_features(&self, passive: bool) -> Result<Vec<String>, ApiError>
pub async fn rich_print(&self) -> Result<String, ApiError>
source§impl Character
impl Character
pub fn new( main_class: String, name: String, age: u16, race_index: String, subrace_index: String, alignment_index: String, description: String, background_index: String, background_description: String, ) -> Self
pub fn class_armor(&self) -> i8
sourcepub fn experience_points(&self) -> u32
pub fn experience_points(&self) -> u32
Returns the experience points of the character
sourcepub fn add_experience(&mut self, experience: u32) -> u8
pub fn add_experience(&mut self, experience: u32) -> u8
Returns the number of levels the character has earned this means that you should add the returned value to a class level (this must be done manually to permit multiclassing)
§Arguments
experience- The experience points to add to the character
pub fn remove_item( &mut self, item: String, amount: Option<u16>, ) -> Result<(), Error>
Trait Implementations§
source§impl<'de> Deserialize<'de> for Character
impl<'de> Deserialize<'de> for Character
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
Auto Trait Implementations§
impl Freeze for Character
impl RefUnwindSafe for Character
impl Send for Character
impl Sync for Character
impl Unpin for Character
impl UnwindSafe for Character
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