Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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;
   |

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();
});
}
@docteurklein

This comment has been minimized.

Copy link
Owner Author

@docteurklein docteurklein commented Sep 18, 2019

turns out I was using the wrong version of fallible_iterator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.