-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds binary eexp subfield span accessors #850
Conversation
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.
🗺️ PR tour
@@ -18,32 +18,6 @@ use crate::lazy::text::raw::v1_1::arg_group::{EExpArg, EExpArgExpr}; | |||
use crate::lazy::text::raw::v1_1::reader::MacroIdRef; | |||
use crate::{try_or_some_err, v1_1, Environment, HasRange, HasSpan, IonResult, Span}; | |||
|
|||
#[derive(Copy, Clone)] | |||
pub struct BinaryEExpHeader { |
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.
🗺️ This type was created to offer methods like those added in this PR, but it was never completed or used.
// will be the beginning of the encoded arguments. | ||
// This index is the first position after the opcode and address. | ||
// If the e-expression has a length prefix, it will begin at this position in `input`. | ||
length_offset: u8, |
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.
🗺️ This type had 6 bytes of padding, so adding another u8
field did not increase its size.
// There is no length prefix, so we re-use the bitmap_offset as the first position | ||
// beyond the opcode and address subfields. | ||
bitmap_offset as u8, |
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.
🗺️ This is in the parser for e-expressions with combined opcode+address bytes. There is never a length prefix.
@@ -996,6 +999,7 @@ impl<'a> BinaryBuffer<'a> { | |||
})? | |||
.reference(); | |||
// Offset from `self`, not offset from the beginning of the stream. | |||
let length_offset = (input_after_address.offset() - self.offset()) as u8; |
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.
🗺️ This is in the parser for 0xF5
, e-expression w/length prefix.
// If these offsets are equal, there are no bytes representing the length. | ||
self.length_offset == self.bitmap_offset |
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.
// If these offsets are equal, there are no bytes representing the length. | |
self.length_offset == self.bitmap_offset | |
// If these offsets are equal, there are no bytes representing the length. | |
self.length_offset != self.bitmap_offset |
If I'm reading this correctly. Though this function does appear unused.
For use in tooling, particularly
ion inspect
. These methods allow an application to access the encoded subfields of a binary 1.1 e-expression.Related to amazon-ion/ion-cli#181.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.