1
Fork 0
mirror of https://github.com/RGBCube/is-even-u16 synced 2025-07-27 06:37:44 +00:00

Initial commit

This commit is contained in:
RGBCube 2024-03-07 11:37:59 +03:00
commit e422e56e91
No known key found for this signature in database
6 changed files with 196719 additions and 0 deletions

10
.gitignore vendored Normal file
View file

@ -0,0 +1,10 @@
*
!src/
!.gitignore
!*.lock
!*.md
!*.rs
!*.toml

7
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 = "is-even-u16"
version = "1.0.0"

8
Cargo.toml Normal file
View file

@ -0,0 +1,8 @@
[package]
name = "is-even-u16"
description = "Specialized is-even checking for u16 numbers"
version = "1.0.0"
license = "MIT"
repository = "https://github.com/RGBCube/is-even-u16"
authors = [ "RGBCube" ]
edition = "2021"

24
LICENSE.md Normal file
View file

@ -0,0 +1,24 @@
# The MIT License
Copyright (c) 2024 RGBCube
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.

61
README.md Normal file
View file

@ -0,0 +1,61 @@
# is-even-u16
Idiomatic is-even checking for Rust.
This crate specializes on unsigned 16 bit numbers for
performance reasons.
## Usage
Run `cargo add is_even_u16`, then you can do this in your
`src/main.rs`:
```rs
use is_even_u16::is_even_u16;
fn main() {
println!("7 is even? {}", if is_even_u16(7) { "yes" } else { "no" });
}
```
You can even check if a number is odd by using the boolean negation
operator provided by the Rust gods!
Here:
```rs
use is_even_u16::is_even_u16;
fn main() {
println!("7 is odd? {}", if !is_even_u16(7) { "yes" } else { "no" });
}
```
## License
```
The MIT License
Copyright (c) 2024 RGBCube
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.
```

196609
src/lib.rs Normal file

File diff suppressed because it is too large Load diff