https://github.com/sachs7/rusties
Basic Rust library and its usage
https://github.com/sachs7/rusties
duke-university learning rust rust-lang
Last synced: about 2 months ago
JSON representation
Basic Rust library and its usage
- Host: GitHub
- URL: https://github.com/sachs7/rusties
- Owner: sachs7
- License: mit
- Created: 2024-05-15T23:39:22.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-20T19:07:08.000Z (about 1 year ago)
- Last Synced: 2025-02-04T18:42:09.032Z (4 months ago)
- Topics: duke-university, learning, rust, rust-lang
- Language: Rust
- Homepage:
- Size: 50.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rusties
Basic Rust library and its usage
### Folder Structure
```
.
Cargo.toml -- Holds project dependencies
src -
| - cli.rs -- CLI menu
| - main.rs -- Entry point of the CLI apprusty_libby -
| - Cargo.toml -- Holds library dependencies
| - src
| - _all files specific to `math` and `word`
```# How to run and sample output
Run: `cargo run --release` -- this will create a `target/release` folder.
Execute the following commands:
```
➜ rusties git:(main) ✗ target/release/rusties help
Rusty Libby 0.1.0
A command line app written in Rust that supports Math and String operations.USAGE:
rustiesFLAGS:
-h, --help Prints help information
-V, --version Prints version informationSUBCOMMANDS:
help Prints this message or the help of the given subcommand(s)
math Math operations like Factorial, Fibonacci, and Prime number check
word String operations like Palindrome and Reverse string
```## Math functions:
#### Help menu:
```
➜ rusties git:(main) ✗ target/release/rusties math --help
rusties-math 0.1.0USAGE:
rusties mathFLAGS:
-h, --help Prints help information
-V, --version Prints version informationSUBCOMMANDS:
factorial Factorial of a number
fibonacci Fibonacci of a number
help Prints this message or the help of the given subcommand(s)
prime-or-not Prime number check
```#### Factorial:
```
➜ rusties git:(main) ✗ target/release/rusties math factorial 4
Factorial of 4 is Factorial of 4 is 24
```## Word functions:
#### Help menu:
```
➜ rusties git:(main) ✗ target/release/rusties word --help
rusties-word 0.1.0USAGE:
rusties wordFLAGS:
-h, --help Prints help information
-V, --version Prints version informationSUBCOMMANDS:
help Prints this message or the help of the given subcommand(s)
palindrome Check if a word is a palindrome
reverse-string Reverse a string
```#### Palindrome:
```
➜ rusties git:(main) ✗ target/release/rusties word palindrome madam
madam is a palindrome➜ rusties git:(main) ✗ target/release/rusties word palindrome list
list is not a palindrome
```# Documentation Tests
```
➜ rusty_libby git:(main) ✗ cargo test
Compiling rusty_libby v0.1.0 (/rusty_libby)
Finished test [unoptimized + debuginfo] target(s) in 1.17s
Running unittests src/lib.rs (target/debug/deps/rusty_libby-382d9f360a4a4dc8)running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests rusty_libby
running 6 tests
test src/fibonacci.rs - fibonacci::fmt (line 9) ... ok
test src/palindrome.rs - palindrome::Palindrome (line 16) ... ok
test src/prime_or_not.rs - prime_or_not::fmt (line 9) ... ok
test src/factorial.rs - factorial::fmt (line 9) ... ok
test src/reverse_string.rs - reverse_string::ReverseString (line 9) ... ok
test src/palindrome.rs - palindrome::Palindrome (line 9) ... oktest result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.02s
➜ rusty_libby git:(main) ✗
```