Skip to content

Commit

Permalink
Fix infinite recursion error
Browse files Browse the repository at this point in the history
  • Loading branch information
untitaker committed Oct 19, 2015
1 parent a24308f commit 1beed06
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ extern crate plugin;
use iron::{Request, Response, BeforeMiddleware, AfterMiddleware, IronResult};
use iron::typemap::Key;
use std::sync::{Arc, RwLock, Mutex};
use std::{error,fmt};
use std::fmt;
use std::error::Error;
use plugin::Plugin;

/// The type that can be returned by `eval` to indicate error.
Expand All @@ -20,20 +21,20 @@ pub enum PersistentError {
NotFound
}

impl fmt::Display for PersistentError {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
self.description().fmt(f)
}
}

impl error::Error for PersistentError {
impl Error for PersistentError {
fn description(&self) -> &str {
match *self {
PersistentError::NotFound => "Value not found in extensions."
}
}
}

impl fmt::Display for PersistentError {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
self.description().fmt(f)
}
}

/// Middleware for data that persists between requests with read and write capabilities.
///
/// The data is stored behind a `RwLock`, so multiple read locks
Expand Down

0 comments on commit 1beed06

Please sign in to comment.