forked from StrafesNET/strafe-project
move ratio to own crate (again)
This commit is contained in:
1
ratio_ops/.gitignore
vendored
Normal file
1
ratio_ops/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/target
|
||||
7
ratio_ops/Cargo.lock
generated
Normal file
7
ratio_ops/Cargo.lock
generated
Normal 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
6
ratio_ops/Cargo.toml
Normal file
@@ -0,0 +1,6 @@
|
||||
[package]
|
||||
name = "ratio_ops"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
1
ratio_ops/src/lib.rs
Normal file
1
ratio_ops/src/lib.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod ratio;
|
||||
10
ratio_ops/src/ratio.rs
Normal file
10
ratio_ops/src/ratio.rs
Normal 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}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user