Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
error[E0599]: no method named `map` found for type `postgres::notification::BlockingIter<'_>` in the current scope
  --> src/
24 ||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() {
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();|notification| {
SSE.push(0, "update", &"test").ok();

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


This comment has been minimized.

Copy link

@rizky rizky commented Feb 19, 2021

stumbled on the same issue, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment