jellymodel 0.1.1

Data models for jellybeanidle
Documentation
use bnum::types::U2048;
use serde::{Deserialize, Serialize};
use std::ops::Add;

#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
pub struct Jel {
    jel: U2048,
}

impl Add<Jel> for Jel {
    type Output = Self;

    fn add(self, other: Jel) -> Self {
        Self {
            jel: self.jel + other.jel,
        }
    }
}

impl Default for Jel {
    fn default() -> Self {
        Self::new()
    }
}

impl Jel {
    pub fn new() -> Self {
        Self { jel: 0u8.into() }
    }
    pub fn jel(&self) -> &U2048 {
        &self.jel
    }
    pub fn update(&mut self, jel: u64) {
        self.jel = jel.into();
    }
    pub fn big_update(&mut self, jel: U2048) {
        self.jel = jel;
    }
    pub fn add_count(&mut self, jel: u64) {
        self.jel = self.jel + jel;
    }
    pub fn big_add_count(&mut self, jel: U2048) {
        self.jel = &self.jel + jel;
    }
}