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
PlexSheep added 1 commit 2024-05-13 13:20:50 +02:00
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
PlexSheep reviewed 2024-05-13 13:27:48 +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
PlexSheep added 1 commit 2024-05-13 13:31:37 +02:00
cargo devel CI / cargo CI (push) Successful in 1m15s Details
18cccddbb2
test: fix numf_parser doctest #13 #5
PlexSheep reviewed 2024-05-13 13:32:23 +02:00
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 added 1 commit 2024-05-13 13:39:58 +02:00
cargo devel CI / cargo CI (push) Failing after 1m17s Details
c6ad45fb82
test: add tests for numf_parser #13
PlexSheep added 1 commit 2024-05-13 13:51:20 +02:00
cargo devel CI / cargo CI (push) Has been cancelled Details
6649470ff7
refactor: numf_parser takes a generic unsigned int #13
PlexSheep added 1 commit 2024-05-13 13:51:49 +02:00
PlexSheep added 2 commits 2024-05-13 14:25:07 +02:00
PlexSheep reviewed 2024-05-13 14:27:32 +02:00
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
PlexSheep added 1 commit 2024-05-13 15:27:25 +02:00
cargo devel CI / cargo CI (push) Successful in 1m17s Details
2f14d672f4
chore: bump libpt to v0.5.1
PlexSheep added 1 commit 2024-05-13 15:45:42 +02:00
PlexSheep reviewed 2024-05-13 15:48:26 +02:00
@ -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
PlexSheep added 1 commit 2024-05-13 15:52:21 +02:00
cargo devel CI / cargo CI (push) Successful in 1m24s Details
7eb00e0f56
refactor: use libpt for joining the base64 parser vec #5 #13
PlexSheep reviewed 2024-05-13 15:53:09 +02:00
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
forgejo-actions added 1 commit 2024-05-13 15:53:44 +02:00
PlexSheep merged commit abb8ed4f2e into devel 2024-05-13 15:54:23 +02:00
PlexSheep deleted branch feat/parse-formats 2024-05-13 15:54:23 +02:00
This repo is archived. You cannot comment on pull requests.
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.