move ratio to own crate (again)

This commit is contained in:
2024-09-10 12:04:18 -07:00
parent fc65d0f1f4
commit 91b96e4b5d
10 changed files with 34 additions and 10 deletions

1
ratio_ops/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/target

7
ratio_ops/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 = 3
[[package]]
name = "ratio_ops"
version = "0.1.0"

6
ratio_ops/Cargo.toml Normal file
View File

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

1
ratio_ops/src/lib.rs Normal file
View File

@@ -0,0 +1 @@
pub mod ratio;

10
ratio_ops/src/ratio.rs Normal file
View File

@@ -0,0 +1,10 @@
#[derive(Clone,Copy,Debug,Hash)]
pub struct Ratio<Num,Den>{
pub(crate)num:Num,
pub(crate)den:Den,
}
impl<Num,Den> Ratio<Num,Den>{
pub const fn new(num:Num,den:Den)->Self{
Self{num,den}
}
}