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

I have to use std::iter::FromIterator; in code calling the api_operation macro #121

Open
Ploppz opened this issue Jul 25, 2024 · 2 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@Ploppz
Copy link

Ploppz commented Jul 25, 2024

I'm just starting to wrap my API in this library. I got this error

error[E0599]: no function or associated item named `from_iter` found for struct `BTreeMap` in the current scope
    --> orchestrator/src/endpoints/measurements.rs:74:1
     |
74   | #[api_operation(summary = "Get an element from the todo list")]
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `BTreeMap<_, _, _>`
     |
note: if you're trying to build a new `BTreeMap<_, _, _>` consider using one of the following associated functions:
      BTreeMap::<K, V>::new
      BTreeMap::<K, V, A>::new_in
      BTreeMap::<K, V, A>::bulk_build_from_sorted_iter
    --> /home/ploppz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/collections/btree/map.rs:629:5
     |
629  |       pub const fn new() -> BTreeMap<K, V> {
     |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
674  |       pub const fn new_in(alloc: A) -> BTreeMap<K, V, A> {
     |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
1472 | /     pub(crate) fn bulk_build_from_sorted_iter<I>(iter: I, alloc: A) -> Self
1473 | |     where
1474 | |         K: Ord,
1475 | |         I: IntoIterator<Item = (K, V)>,
     | |_______________________________________^
     = help: items from traits can only be used if the trait is in scope
     = note: this error originates in the attribute macro `api_operation` (in Nightly builds, run with -Z macro-backtrace for more info)
help: trait `FromIterator` which provides `from_iter` is implemented but not in scope; perhaps you want to import it
     |
1    + use std::iter::FromIterator;
     |

Just want to suggest to use fully qualified syntax to use FromIterator::from_iter for example so that library users don't have to import that trait.

@Ploppz Ploppz changed the title I have to use std::iter::FromIterator; in code calling the api_operation macro? I have to use std::iter::FromIterator; in code calling the api_operation macro Jul 25, 2024
@rlebran rlebran added the bug Something isn't working label Aug 4, 2024
@rlebran rlebran self-assigned this Aug 4, 2024
@rlebran
Copy link
Contributor

rlebran commented Aug 4, 2024

Hi,

Sorry for the delay, I'm having a look.

@rlebran
Copy link
Contributor

rlebran commented Aug 4, 2024

Is it possible to provide a minimal reproduction example please ? I'm currently unable to reproduce.

@rlebran rlebran added the question Further information is requested label Aug 4, 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 question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants