Skip to content

Commit

Permalink
Merge pull request #24 from cospectrum/bit-doc
Browse files Browse the repository at this point in the history
Edit doc for Bit
  • Loading branch information
magiclen committed Jan 7, 2024
2 parents e4e4447 + 59a923b commit 91b9ef1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
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

0 comments on commit 91b9ef1

Please sign in to comment.