Skip to content
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

Add read_element and read_element_ref methods to the IonReader trait, impls #421

Closed
zslayton opened this issue Sep 16, 2022 · 1 comment
Closed

Comments

@zslayton
Copy link
Contributor

Currently the ability to read Element values is provided by implementations of the ElementReader trait. Historically, this included an implementation provided by ion-c-sys IonCElementReader as well as a native Rust implementation (NativeElementReader).

However, following PR #418, ion-rust no longer has a dependency on ion-c-sys. We should merge the functionality defined by ElementReader into IonReader, allowing applications to read the current value as either a known Rust type (read_f64()) or an Element (read_element()).

We should also offer methods to iterate across the elements of the current level.

Straw man method signatures

fn read_element(&mut self) -> IonResult<Element>;
fn read_element_ref<'a>(&'a mut self) -> IonResult<ElementRef<'a>>;
fn elements<'a>(&mut self) -> ElementIterator<'a>; // next() returns Option<IonResult<Element>> 
fn element_refs<'a>(&mut self) -> IonResult<ElementRefIterator<'a>>;
@zslayton
Copy link
Contributor Author

Fixed in #485.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant