Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit doc for Bit #24

Merged
merged 1 commit into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ Usage of the `Bit` struct and the `Byte` struct is very similar. Also, There is
```rust
use byte_unit::{Bit, Unit};

let byte = Bit::parse_str("123Kib").unwrap();
let bit = Bit::parse_str("123Kib").unwrap();

let adjusted_byte = byte.get_adjusted_unit(Unit::Kbit);
let adjusted_bit = bit.get_adjusted_unit(Unit::Kbit);

assert_eq!("125.952 Kb", adjusted_byte.to_string());
assert_eq!("125.95 Kb", format!("{adjusted_byte:.2}"));
assert_eq!("125.952 Kb", adjusted_bit.to_string());
assert_eq!("125.95 Kb", format!("{adjusted_bit:.2}"));
```

## No Std
Expand Down Expand Up @@ -188,4 +188,4 @@ https://docs.rs/byte-unit

## License

[MIT](LICENSE)
[MIT](LICENSE)
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ Usage of the `Bit` struct and the `Byte` struct is very similar. Also, There is
# {
use byte_unit::{Bit, Unit};

let byte = Bit::parse_str("123Kib").unwrap();
let bit = Bit::parse_str("123Kib").unwrap();

let adjusted_byte = byte.get_adjusted_unit(Unit::Kbit);
let adjusted_bit = bit.get_adjusted_unit(Unit::Kbit);

assert_eq!("125.952 Kb", adjusted_byte.to_string());
assert_eq!("125.95 Kb", format!("{adjusted_byte:.2}"));
assert_eq!("125.952 Kb", adjusted_bit.to_string());
assert_eq!("125.95 Kb", format!("{adjusted_bit:.2}"));
# }
```

Expand Down