Skip to content

next() function on item stream breaks trait #50

@zignig

Description

@zignig

When extracting from the tauri-todos example with 0.9x I came across some weirdness.

trying to get the keys from a doc

let entries = self.doc.get_many(Query::single_latest_per_key()).await?;

and then scan through items

       let mut notes = Vec::new();
        while let Some(entry) = entries.next().await {
                let entry = entry?;
                let note = self.note_from_entry(&entry).await?;
                if !note.is_delete {
                    notes.push(note)
                }
        }

The "entries.next().await" fails with

error[E0277]: `{async block@...::into_stream::{closure#0}::{closure#0}}` cannot be unpinned
    --> src/notes.rs:111:41
     |
111  |         while let Some(entry) = entries.next().await {
     |                                         ^^^^ unsatisfied trait bound
     |
     = help: within `__Origin<'_, Receiver<...>, ..., ...>`, the trait `Unpin` is not implemented for `{async block@...::into_stream::{closure#0}::{closure#0}}`
     = note: consider using the `pin!` macro
             consider using `Box::pin` if you need to access the pinned value outside of the current scope
note: required because it appears within the type `Option<...>`

.collect() and other iterator functions work , but not next().await

I am using use n0_future::{Stream, StreamExt}; ( version 0.2.0 )

Sometimes the rust errors confuse me... ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions