Skip to content

Commit 6453d25

Browse files
authored
Update README.md
1 parent 7422a14 commit 6453d25

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# 📦 prefix_parse
2-
A lightweight Rust crate for parsing numeric strings with radix-indicating prefixes like 0x, 0o, and 0b. It provides a trait-based interface for parsing numbers with standard or custom prefixes, supporting any type that implements [num_traits::Num](https://docs.rs/num-traits/latest/num_traits/trait.Num.html). Which includes all base rust numeric types.
2+
A lightweight crate for parsing numeric strings with radix-indicating prefixes like `0x`, `0o`, and `0b`, or any other custom prefix, supporting any type that implements [num_traits::Num](https://docs.rs/num-traits/latest/num_traits/trait.Num.html). This includes all base rust numeric types.
33

4-
The implementation relies on `[from_str_radix](https://docs.rs/num-traits/0.2.19/num_traits/trait.Num.html#tymethod.from_str_radix)` internally, so the same limitations and capabilities present their apply.
4+
The implementation relies on [from_str_radix](https://docs.rs/num-traits/0.2.19/num_traits/trait.Num.html#tymethod.from_str_radix) internally, so the same limitations and capabilities present there apply.
55

66
## ✨ Features
7-
- ✅ Parse hexadecimal (0x), octal (0o), binary (0b), and decimal numbers
8-
- ✅ Support for custom prefix formats and arbitrary radices
9-
- ✅ Works with any type implementing Num, including u32, i64, u8, etc.
7+
- ✅ Parse hexadecimal (`0x`), octal (`0o`), binary (`0b`), and decimal numbers.
8+
- ✅ Support for custom prefix formats and arbitrary radices.
9+
- ✅ Works with any type implementing [Num](https://docs.rs/num-traits/latest/num_traits/trait.Num.html), including `u32`, `i64`, `u8`, `usize`, etc.
1010

11-
### Detect common prefixes
11+
### Auto Detect common prefixes
12+
Handles, hexadecimal (`0x`), octal (`0o`), binary (`0b`), and decimal numbers ('').
1213
```rust
1314
use prefix_parse::PrefixParse;
1415

@@ -19,6 +20,7 @@ assert_eq!(u32::parse("10"), Ok(10));
1920
```
2021

2122
### Built-in Prefixes
23+
Handles preconfigured prefixes.
2224
```rust
2325
use prefix_parse::{PrefixParse, HEX, OCT, BIN, DEC};
2426

@@ -29,6 +31,7 @@ assert_eq!(u32::parse_with(&DEC, "42"), Ok(42));
2931
```
3032

3133
### Custom Prefixes
34+
Allows definition of custom prefixes.
3235
```rust
3336
use prefix_parse::{PrefixFmt, PrefixParse};
3437
let base36 = PrefixFmt {
@@ -40,7 +43,7 @@ assert_eq!(u32::parse_with(&base36, "0z1jz"), Ok(2015));
4043
```
4144

4245
## 🔧 Extending
43-
Any new type that implements `Num` from `num_traits` will automatically implement this.
46+
Any new type that implements [Num](https://docs.rs/num-traits/latest/num_traits/trait.Num.html) from [num_traits](https://crates.io/crates/num-traits) will automatically implement this.
4447

4548
## 📝 License
4649
MIT or Apache-2.0 — your choice.

0 commit comments

Comments
 (0)