diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-14 23:17:26 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-14 23:17:26 -0700 |
commit | 2c56f2b65bcf3b3f85db9d2a34501154c9c9404d (patch) | |
tree | d9580fb8578f6e1ea0f47dd1e6402ebd41d3a0e9 /rust/src/api_lib.rs | |
parent | e468707ee53f4a8ff75b00a1eec44921672464b6 (diff) | |
download | fatcat-2c56f2b65bcf3b3f85db9d2a34501154c9c9404d.tar.gz fatcat-2c56f2b65bcf3b3f85db9d2a34501154c9c9404d.zip |
regenerated and pseudo-integrated
Diffstat (limited to 'rust/src/api_lib.rs')
-rw-r--r-- | rust/src/api_lib.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/rust/src/api_lib.rs b/rust/src/api_lib.rs new file mode 100644 index 00000000..cc8c2313 --- /dev/null +++ b/rust/src/api_lib.rs @@ -0,0 +1,34 @@ +//! Main library entry point for fatcat implementation. + +// Imports required by server library. +// extern crate fatcat; +// extern crate swagger; +extern crate futures; +extern crate chrono; +#[macro_use] +extern crate error_chain; + +mod server; + +mod errors { + error_chain!{} +} + +pub use self::errors::*; +use std::io; +use hyper; +use fatcat; + +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)) + } +} |