PkmnLib_rs/src/static_data/libraries/library_settings.rs

42 lines
1.1 KiB
Rust
Executable File

use crate::defines::LevelInt;
use crate::{ValueIdentifiable, ValueIdentifier};
use std::fmt::Debug;
/// This library holds several misc settings for the library.
pub trait LibrarySettings: Debug + ValueIdentifiable {
/// The highest level a Pokemon can be.
fn maximum_level(&self) -> LevelInt;
}
/// This library holds several misc settings for the library.
#[derive(Debug)]
pub struct LibrarySettingsImpl {
/// A unique identifier so we know what value this is.
identifier: ValueIdentifier,
/// The highest level a Pokemon can be.
maximum_level: LevelInt,
}
impl LibrarySettingsImpl {
/// Creates a new settings library.
pub fn new(maximum_level: LevelInt) -> Self {
Self {
identifier: Default::default(),
maximum_level,
}
}
}
impl LibrarySettings for LibrarySettingsImpl {
/// The highest level a Pokemon can be.
fn maximum_level(&self) -> LevelInt {
self.maximum_level
}
}
impl ValueIdentifiable for LibrarySettingsImpl {
fn value_identifier(&self) -> ValueIdentifier {
self.identifier
}
}