diff options
Diffstat (limited to 'rust/fatcat-api/examples/server_lib/mod.rs')
-rw-r--r-- | rust/fatcat-api/examples/server_lib/mod.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/rust/fatcat-api/examples/server_lib/mod.rs b/rust/fatcat-api/examples/server_lib/mod.rs new file mode 100644 index 00000000..a45fbe50 --- /dev/null +++ b/rust/fatcat-api/examples/server_lib/mod.rs @@ -0,0 +1,26 @@ +//! Main library entry point for fatcat implementation. + +mod server; + +mod errors { + error_chain!{} +} + +pub use self::errors::*; +use fatcat; +use hyper; +use std::io; + +pub struct NewService; + +impl hyper::server::NewService for NewService { + type Request = (hyper::Request, fatcat::Context); + type Response = hyper::Response; + type Error = hyper::Error; + type Instance = fatcat::server::Service<server::Server>; + + /// Instantiate a new server. + fn new_service(&self) -> io::Result<Self::Instance> { + Ok(fatcat::server::Service::new(server::Server)) + } +} |