error[E0599]: no method named `map` found for type `postgres::notification::BlockingIter<'_>` in the current scope
--> src/main.rs:24:19
|
24 | notifications.map(|notification| {
| ^^^
|
= note: the method `map` exists but the following trait bounds were not satisfied:
`&mut postgres::notification::BlockingIter<'_> : fallible_iterator::FallibleIterator`
`&mut postgres::notification::BlockingIter<'_> : std::iter::Iterator`
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
|
5 | use fallible_iterator::FallibleIterator;
|
Created
September 17, 2019 21:59
-
-
Save docteurklein/ed220cac282d2d8edf154b594feec6ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate hyper_sse; | |
extern crate postgres; | |
#[macro_use] extern crate lazy_static; | |
use hyper_sse::Server; | |
use postgres::{Connection, TlsMode}; | |
use fallible_iterator::FallibleIterator; | |
use std::iter::Iterator; | |
lazy_static! { | |
static ref SSE: Server<u8> = Server::new(); | |
} | |
fn main() { | |
SSE.spawn("[::1]:3000".parse().unwrap()); | |
let auth_token = SSE.generate_auth_token(Some(0)).unwrap(); | |
println!("http://[::1]:3000/push/0?{}", auth_token); | |
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap(); | |
conn.execute("LISTEN test", &[]).unwrap(); | |
let mut notifications = conn.notifications().blocking_iter(); | |
notifications.map(|notification| { | |
SSE.push(0, "update", &"test").ok(); | |
}); | |
} |
stumbled on the same issue, thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
turns out I was using the wrong version of
fallible_iterator