-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
33fd467
commit 98f0dc2
Showing
5 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ use std::str; | |
use std::convert; | ||
use std::string; | ||
|
||
mod server; | ||
mod parser; | ||
mod ast; | ||
mod generator; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use runner::Runner; | ||
use protocol::{Deserializer, ThriftDeserializer}; | ||
use binary_protocol::BinaryDeserializer; | ||
use std::io::Cursor; | ||
|
||
pub type Default = BinaryDeserializer<Cursor<Vec<u8>>>; | ||
|
||
/// Manages incoming RPC requests from a Mio event loop and dispatches it | ||
/// to a runner that will then deserialize the Thrift message and call the appropriate | ||
/// RPC function. | ||
/// | ||
/// The server will also manage the response coming back from the RPC method through | ||
/// the use of futures. These will be coordinated back to Mio. | ||
pub struct Server<R: Runner<Default>> { | ||
de: Default, | ||
runner: R | ||
} | ||
|
||
impl<R> Server<R> | ||
where R: Runner<Default> | ||
{ | ||
pub fn new(runner: R) -> Server<R> { | ||
Server { | ||
de: BinaryDeserializer::new(Cursor::new(Vec::new())), | ||
runner: runner | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters