add parser for all formats #13

Merged
PlexSheep merged 11 commits from feat/parse-formats into devel 2024-05-13 15:54:23 +02:00
Owner

Refs: #5

  • impl base64 and base32
  • add tests for the numf_parser
  • make numf_parser generic for all unsigned ints
Refs: #5 - [x] impl base64 and base32 - [x] add tests for the numf_parser - [x] make numf_parser generic for all unsigned ints
feat: add a parser that can be used with clap for all formats except base32 and base64
Some checks failed
cargo devel CI / cargo CI (push) Failing after 1m16s
399021ecc6
Refs: #5
PlexSheep changed title from WIP: feat: add a parser that can be used with clap for all formats except base32 and base64 to WIP: add parser for all formats 2024-05-13 13:21:14 +02:00
src/format.rs Outdated
@ -216,0 +287,4 @@
Err(anyhow!(e))
}
}
} else if s.starts_with(&Format::Base64.prefix()) {
Author
Owner

add functionalits for base64

add functionalits for base64
PlexSheep marked this conversation as resolved
@ -216,0 +290,4 @@
} else if s.starts_with(&Format::Base64.prefix()) {
let e = "parsing of base64 is not yet implemented".to_string();
Err(anyhow!(e))
} else if s.starts_with(&Format::Base32.prefix()) {
Author
Owner

add functionalits for base32

add functionalits for base32
PlexSheep marked this conversation as resolved
test: fix numf_parser doctest #13 #5
All checks were successful
cargo devel CI / cargo CI (push) Successful in 1m15s
18cccddbb2
src/format.rs Outdated
@ -216,0 +238,4 @@
/// let args = Args::parse_from(&["", "-a", "0x10"]);
/// assert_eq!(args.address, 16);
/// ```
pub fn numf_parser(s: &str) -> anyhow::Result<NumberType> {
Author
Owner

Make this function generic for all unsigned integer types

Make this function generic for all unsigned integer types
PlexSheep marked this conversation as resolved
PlexSheep referenced this pull request from a commit 2024-05-13 13:39:58 +02:00
test: add tests for numf_parser #13
Some checks failed
cargo devel CI / cargo CI (push) Failing after 1m17s
c6ad45fb82
refactor: numf_parser takes a generic unsigned int #13
Some checks failed
cargo devel CI / cargo CI (push) Has been cancelled
6649470ff7
test: numf_parser test for all types that should be supported by the generic #13
Some checks failed
cargo devel CI / cargo CI (push) Failing after 1m9s
47894a3f26
feat: add hacky parsing for base32 and base64 #13 #5
All checks were successful
cargo devel CI / cargo CI (push) Successful in 1m17s
68d9cdaf69
src/format.rs Outdated
@ -216,0 +300,4 @@
None => s,
};
match fast32::base64::RFC4648.decode_str(s) {
Ok(r) => {
Author
Owner

implement building the u128 from a Vec in libpt-bintols and use the dependency for this

implement building the `u128` from a Vec in libpt-bintols and use the dependency for this
PlexSheep marked this conversation as resolved
Author
Owner
see https://git.cscherr.de/PlexSheep/pt/issues/79
chore: bump libpt to v0.5.1
All checks were successful
cargo devel CI / cargo CI (push) Successful in 1m17s
2f14d672f4
refactor: use libpt to join the fast32 vecs into the integer type #13 #5
All checks were successful
cargo devel CI / cargo CI (push) Successful in 1m19s
1bb0ffd6f8
@ -20,2 +20,3 @@
fast32 = "1.0.2"
libpt = { version = "0.5.0", features = ["bintols"]}
libpt = { version = "0.5.1", features = ["bintols"]}
num = "0.4.3"
Author
Owner

remove num if it's not needed

remove num if it's not needed
Author
Owner

yup we need that

yup we need that
PlexSheep marked this conversation as resolved
@ -216,0 +307,4 @@
};
match fast32::base64::RFC4648.decode_str(s) {
Ok(r) => {
if r.len() > 16 {
Author
Owner

use libpt here too!

use libpt here too!
PlexSheep marked this conversation as resolved
refactor: use libpt for joining the base64 parser vec #5 #13
All checks were successful
cargo devel CI / cargo CI (push) Successful in 1m24s
7eb00e0f56
PlexSheep left a comment
Author
Owner

ok

ok
PlexSheep changed title from WIP: add parser for all formats to add parser for all formats 2024-05-13 15:53:12 +02:00
PlexSheep deleted branch feat/parse-formats 2024-05-13 15:54:23 +02:00
Commenting is not possible because the repository is archived.
No reviewers
No milestone
No project
No assignees
2 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: PlexSheep/numf#13
No description provided.