Begin planning out trait(s)

main
John Zacarias Jekel 10 months ago
parent 564aff86ac
commit f1d0b64097
  1. 37
      Cargo.toml
  2. 9
      LICENSE
  3. 120
      lib/lib.rs
  4. 16
      src/lib.rs

@ -7,7 +7,6 @@ readme = "README.md"
#homepage = ""
repository = "https://git.jekel.ca/JZJ/quickbits"
license = "MIT"
#license-file = "LICENSE"
edition = "2021"
#keywords = ["", ""]
#categories = ["", "", ""]
@ -19,28 +18,28 @@ edition = "2021"
#nightly-features = ["nightly-features-benches"]
#nightly-features-benches = []
#[lib]
#name = "anslatortray"
#path = "src/lib.rs"
[lib]
name = "quickbits"
path = "lib/lib.rs"
#[[bin]]
#name = "anslatortray"
#path = "src/anslatortray.rs"
#[profile.dev]
#incremental = true
[profile.dev]
incremental = true
#[profile.release]
#codegen-units = 1
#strip = true
#overflow-checks = false
#panic = "abort"
#lto = true
[profile.release]
codegen-units = 1
strip = true
overflow-checks = false
panic = "abort"
lto = true
#[profile.release-with-debug]
#inherits = "release"
#strip = false
#overflow-checks = false
#panic = "abort"
#lto = false
#debug = true
[profile.release-with-debug]
inherits = "release"
strip = false
overflow-checks = false
panic = "abort"
lto = false
debug = true

@ -0,0 +1,9 @@
MIT License
Copyright (c) 2023 John Jekel
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -0,0 +1,120 @@
/*
* File: lib.rs
* Brief: TODO
*
* Copyright: Copyright (C) 2023 John Jekel
* See the LICENSE file at the root of the project for licensing info.
*
* TODO longer description
*
*/
/*!
* TODO rustdoc for this file here
*/
/* ------------------------------------------------------------------------------------------------
* Submodules
* --------------------------------------------------------------------------------------------- */
//TODO
/* ------------------------------------------------------------------------------------------------
* Uses
* --------------------------------------------------------------------------------------------- */
use std::ops::Range;
/* ------------------------------------------------------------------------------------------------
* Macros
* --------------------------------------------------------------------------------------------- */
//TODO (also pub(crate) use the_macro statements here too)
/* ------------------------------------------------------------------------------------------------
* Constants
* --------------------------------------------------------------------------------------------- */
//TODO
/* ------------------------------------------------------------------------------------------------
* Static Variables
* --------------------------------------------------------------------------------------------- */
//TODO
/* ------------------------------------------------------------------------------------------------
* Types
* --------------------------------------------------------------------------------------------- */
//TODO includes "type"-defs, structs, enums, unions, etc
/* ------------------------------------------------------------------------------------------------
* Associated Functions and Methods
* --------------------------------------------------------------------------------------------- */
//TODO
/* ------------------------------------------------------------------------------------------------
* Traits And Default Implementations
* --------------------------------------------------------------------------------------------- */
//TODO
/* ------------------------------------------------------------------------------------------------
* Trait Implementations
* --------------------------------------------------------------------------------------------- */
trait BitManip: Sized {
/*const*/ fn bit(&self, bit: Self) -> Self;
/*const*/ fn bits(&self, range: Range<Self>) -> Self;
/*const*/ fn set_bit(&self, bit: Self) -> Self;
/*const*/ fn set_bit_assign(&mut self, bit: Self);
/*const*/ fn set_bits(&self, range: Range<Self>) -> Self;
/*const*/ fn set_bits_assign(&mut self, range: Range<Self>);
/*const*/ fn clear_bit(&self, bit: Self) -> Self;
/*const*/ fn clear_bit_assign(&mut self, bit: Self);
/*const*/ fn clear_bits(&self, range: Range<Self>) -> Self;
/*const*/ fn clear_bits_assign(&mut self, range: Range<Self>);
/*const*/ fn toggle_bit(&self, bit: Self) -> Self;
/*const*/ fn toggle_bit_assign(&mut self, bit: Self);
/*const*/ fn toggle_bits(&self, range: Range<Self>) -> Self;
/*const*/ fn toggle_bits_assign(&mut self, range: Range<Self>);
/*const*/ fn replace_bit(&self, bit: Self, value: Self) -> Self;
/*const*/ fn replace_bit_assign(&mut self, bit: Self value: Self);
/*const*/ fn replace_bits(&self, range: Range<Self>, value: Self) -> Self;
/*const*/ fn replace_bits_assign(&mut self, range: Range<Self>, value: Self);
/*const*/ fn bitmask(range: Range<Self>) -> Self;
//TODO others
}
/*trait BitManipBool: BitManip {
/*const*/ fn bit(&self, bit: Self) -> bool {
BitManip::bit(self, bit) == 1
}
//TODO others
}*/
/* ------------------------------------------------------------------------------------------------
* Functions
* --------------------------------------------------------------------------------------------- */
//TODO
/* ------------------------------------------------------------------------------------------------
* Tests
* --------------------------------------------------------------------------------------------- */
//TODO
/* ------------------------------------------------------------------------------------------------
* Benchmarks
* --------------------------------------------------------------------------------------------- */
//TODO

@ -1,16 +0,0 @@
//! Coming soon :)
pub fn add(left: usize, right: usize) -> usize {
left + right
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
Loading…
Cancel
Save