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

Trait WriteAsIon is not implemented for Element #844

Open
popematt opened this issue Oct 21, 2024 · 0 comments
Open

Trait WriteAsIon is not implemented for Element #844

popematt opened this issue Oct 21, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@popematt
Copy link
Contributor

error[E0277]: the trait bound `ion_rs::Element: WriteAsIon` is not satisfied
   --> src/bin/ion/commands/schema/validate.rs:234:26
    |
234 |             writer.write(ion_list![].with_annotations(["valid"]))
    |                    ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `WriteAsIon` is not implemented for `ion_rs::Element`
    |                    |
    |                    required by a bound introduced by this call
    |
note: required by a bound in `ion_rs::ValueWriter::write`
   --> /Users/popematt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ion-rs-1.0.0-rc.8/src/lazy/encoder/value_writer.rs:78:32
    |
78  |     fn write(self, value: impl WriteAsIon) -> IonResult<()> {
    |                                ^^^^^^^^^^ required by this bound in `ValueWriter::write`
help: consider borrowing here
    |
234 |             writer.write(&ion_list![].with_annotations(["valid"]))
    |                          +

More generally, it seems like WriteAsIon is implemented for references rather than owned values for a number of things in the data model. This is going to be a bit of a surprise to everyone who is starting to use ion-rust for the first time if we leave things the way they are.

@popematt popematt added the bug Something isn't working label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant