From a0c8ea4f904c4f68b0d073fe0c4738e2f9ce46d7 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Sat, 25 Jul 2020 17:51:37 -0400 Subject: [PATCH] expose Error type as AnyError --- src/lib.rs | 2 +- src/server/mod.rs | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 37f4b54..ad11036 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,4 +14,4 @@ pub use client::{get, Error as ClientError}; #[cfg(feature = "server")] mod server; #[cfg(feature = "server")] -pub use server::{Handler, serve, serve_plain}; +pub use server::{serve, serve_plain, Error as AnyError, Handler}; diff --git a/src/server/mod.rs b/src/server/mod.rs index 40c388d..a412f22 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -1,13 +1,20 @@ use crate::Response; -use std::{error::Error, io}; +use std::{error::Error as StdError, io}; use url::Url; +/// A Gemini request and its associated metadata. +pub struct Request { + url: Url, +} + +pub type Error = Box; + #[allow(dead_code, unused_assignments, unused_mut, unused_variables)] mod routes; pub use routes::*; pub trait Handler { - fn handle(u: Url) -> Result>; + fn handle(r: Request) -> Result; } pub fn serve(_h: impl Handler, _port: u16) -> io::Result<()> {