-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from mattrberry/namedtuple_refactor
Moved all parts to NamedTuples
- Loading branch information
Showing
1 changed file
with
77 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7b464ce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stakach I think the version still needs to be bumped after this change
7b464ce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be up as
v1.5.0
7b464ce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I see, I bumped the shard.yml version before merging but I didn't tag the release until after the merge so
v1.5.0
has all the changes7b464ce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I understand now. Looks good!
7b464ce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question for you while you're online. I'm interested in another macro called
save_all_bytes
or something along those lines, that would effectively save a copy of all of the bytes read from the IO.My specific usecase for this is that I want to parse a packet with a non-obvious checksum of all of the bytes read up to that point. Rather than looking at all of the fields I've already parsed out, I think it'd be convenient to have a
save_all_bytes :all_bytes
macro available.However, I can't think of a clean, fast, memory-efficient way of doing this. Does anything come to mind immediately for you? I can definitely hack together a solution, but I figure you might have some ideas.
7b464ce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is more convenient than
which would grow significantly with more complicated examples
7b464ce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I see your point.
I assume the checksum itself shouldn't be included in the calculation either so would need to take that into account.
I don't think there is anyway to do that in a memory efficient manner, could be done in a CPU efficient manner.
Basically after something akin to a union.
Also I assume the bytes would need to be accurate when building a message too which could be challenging.
7b464ce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll go ahead and throw something together later tonight and see what I can come up with.