Compare commits

...

8 Commits

16 changed files with 144 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
01.workspace/target

7
01.workspace/Cargo.lock generated Normal file
View File

@@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "oxidice_lib"
version = "0.1.0"

5
01.workspace/Cargo.toml Normal file
View File

@@ -0,0 +1,5 @@
[workspace]
resolver = "3"
members = ["oxidice_lib"]

View File

@@ -0,0 +1,6 @@
[package]
name = "oxidice_lib"
version = "0.1.0"
edition = "2024"
[dependencies]

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,10 @@
use crate::*;
impl Die {
pub fn new(sides: u16) -> Self {
Self { sides }
}
}
// #[cfg(test)]
// mod unit_tests { use super::*; }

View File

@@ -0,0 +1,11 @@
use crate::*;
impl Handful {
pub fn grab(dice_num: u16, sides: u16) -> Self {
let mut dice = Vec::<Die>::new();
for _ in 1..=dice_num {
dice.push(Die::new(sides));
}
Self { dice }
}
}

View File

@@ -0,0 +1,2 @@
pub mod die_new;
pub mod handful_grab;

View File

@@ -0,0 +1,12 @@
use std::*;
mod fun;
mod imp;
mod mcr;
mod str;
mod trt;
mod tst;
pub(crate) use crate::str::die::O as Die;
pub(crate) use crate::str::failed_to::E as FailedTo;
pub(crate) use crate::str::handful::O as Handful;

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,17 @@
use crate::*;
#[derive(Debug, Default, PartialEq, Clone)]
pub struct O {
pub(crate) sides: u16,
}
// impl std::fmt::Display for O {
// fn fmt(&self, _f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
// todo!();
// }
// }
// #[cfg(test)]
// mod unit_tests {
// use super::*;
// }

View File

@@ -0,0 +1,49 @@
use crate::*;
// use std::fmt::Display;
// use std::str::FromStr;
#[derive(Debug, PartialEq, PartialOrd, Eq, Ord, Clone, Copy, Hash)]
pub enum E {}
// impl Display for E {
// fn fmt(&self, f: &mut std::fmt::Formatter) -> std::result::Result<(), std::fmt::Error> {
// match self {
// Self::NoValue => write!(f, "NoValue"),
// }
// }
// }
// impl FromStr for E {
// type Err = Box<dyn std::error::Error>;
// fn from_str(value: &str) -> std::result::Result<Self, Box<dyn std::error::Error>> {
// match value {
// "NoValue" => Ok(Self::NoValue),
// _ => unreachable!(),
// }
// }
// }
// #[cfg(test)]
// mod unit_tests {
// use super::*;
// #[test]
// fn check_001() {
// for value in [E::NoValue] {
// match value {
// E::NoValue => assert_eq!(
// E::NoValue,
// E::from_str("NoValue").unwrap()
// ),
// }
// }
// }
//
// #[test]
// fn check_002() {
// for value in [E::NoValue] {
// match value {
// E::NoValue => assert_eq!(&E::NoValue.to_string(), "NoValue"),
// }
// }
// }
// }

View File

@@ -0,0 +1,17 @@
use crate::*;
#[derive(Debug, Default, PartialEq, Clone)]
pub struct O {
pub(crate) dice: Vec<Die>,
}
// impl std::fmt::Display for O {
// fn fmt(&self, _f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
// todo!();
// }
// }
// #[cfg(test)]
// mod unit_tests {
// use super::*;
// }

View File

@@ -0,0 +1,3 @@
pub mod die;
pub mod failed_to;
pub mod handful;

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1 @@