iron: Error on attempt to use Plugin::get_ref

I have a code

use iron::{Request, Response};
use urlencoded::UrlEncodedQuery;

pub fn get(req: &mut Request) -> IronResult<Response> {
    let code = match req.get_ref::<UrlEncodedQuery>() {
        Ok(ref query) => query["code"][0],
        Err(ref e) => panic!("Error = {:?}", e),
    };
    // Implementation details
}

It doesn’t compile because there is no get_ref on Request.

The compiler suggests me use iron::Pluggable. I am inserting and it doesn’t see Pluggable in iron.

Documentation generated with cargo doc contains screenshot from 2016-04-12 16 16 27

I am replacing use iron::Pluggable with use iron::prelude::Pluggable, but the compiler ensure there is no Pluggable in iron::prelude.

I replace use iron::prelude::Pluggable with iron::Plugin and it works.

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Renaming API because of possible bugs in the compiler (and rustdoc) sounds unappealing. This name has been like that forever, so I have no idea what caused the docs to end up like that.