Upgrading vendor folder dependencies.
This commit is contained in:
parent
4a0cbcd770
commit
acbe9ad9e5
229 changed files with 10735 additions and 4528 deletions
13
vendor/git.apache.org/thrift.git/tutorial/rs/src/bin/tutorial_client.rs
generated
vendored
13
vendor/git.apache.org/thrift.git/tutorial/rs/src/bin/tutorial_client.rs
generated
vendored
|
@ -22,8 +22,9 @@ extern crate thrift;
|
|||
extern crate thrift_tutorial;
|
||||
|
||||
use thrift::protocol::{TCompactInputProtocol, TCompactOutputProtocol};
|
||||
use thrift::transport::{ReadHalf, TFramedReadTransport, TFramedWriteTransport, TIoChannel,
|
||||
TTcpChannel, WriteHalf};
|
||||
use thrift::transport::{
|
||||
ReadHalf, TFramedReadTransport, TFramedWriteTransport, TIoChannel, TTcpChannel, WriteHalf,
|
||||
};
|
||||
|
||||
use thrift_tutorial::shared::TSharedServiceSyncClient;
|
||||
use thrift_tutorial::tutorial::{CalculatorSyncClient, Operation, TCalculatorSyncClient, Work};
|
||||
|
@ -70,8 +71,7 @@ fn run() -> thrift::Result<()> {
|
|||
let logid = 32;
|
||||
|
||||
// let's do...a multiply!
|
||||
let res = client
|
||||
.calculate(logid, Work::new(7, 8, Operation::MULTIPLY, None))?;
|
||||
let res = client.calculate(logid, Work::new(7, 8, Operation::Multiply, None))?;
|
||||
println!("multiplied 7 and 8 and got {}", res);
|
||||
|
||||
// let's get the log for it
|
||||
|
@ -81,7 +81,7 @@ fn run() -> thrift::Result<()> {
|
|||
// ok - let's be bad :(
|
||||
// do a divide by 0
|
||||
// logid doesn't matter; won't be recorded
|
||||
let res = client.calculate(77, Work::new(2, 0, Operation::DIVIDE, "we bad".to_owned()));
|
||||
let res = client.calculate(77, Work::new(2, 0, Operation::Divide, "we bad".to_owned()));
|
||||
|
||||
// we should have gotten an exception back
|
||||
match res {
|
||||
|
@ -103,8 +103,7 @@ fn run() -> thrift::Result<()> {
|
|||
type ClientInputProtocol = TCompactInputProtocol<TFramedReadTransport<ReadHalf<TTcpChannel>>>;
|
||||
type ClientOutputProtocol = TCompactOutputProtocol<TFramedWriteTransport<WriteHalf<TTcpChannel>>>;
|
||||
|
||||
fn new_client
|
||||
(
|
||||
fn new_client(
|
||||
host: &str,
|
||||
port: u16,
|
||||
) -> thrift::Result<CalculatorSyncClient<ClientInputProtocol, ClientOutputProtocol>> {
|
||||
|
|
41
vendor/git.apache.org/thrift.git/tutorial/rs/src/bin/tutorial_server.rs
generated
vendored
41
vendor/git.apache.org/thrift.git/tutorial/rs/src/bin/tutorial_server.rs
generated
vendored
|
@ -65,7 +65,9 @@ fn run() -> thrift::Result<()> {
|
|||
let o_prot_fact = TCompactOutputProtocolFactory::new();
|
||||
|
||||
// demux incoming messages
|
||||
let processor = CalculatorSyncProcessor::new(CalculatorServer { ..Default::default() });
|
||||
let processor = CalculatorSyncProcessor::new(CalculatorServer {
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
// create the server and start listening
|
||||
let mut server = TServer::new(
|
||||
|
@ -87,7 +89,9 @@ struct CalculatorServer {
|
|||
|
||||
impl Default for CalculatorServer {
|
||||
fn default() -> CalculatorServer {
|
||||
CalculatorServer { log: Mutex::new(HashMap::new()) }
|
||||
CalculatorServer {
|
||||
log: Mutex::new(HashMap::new()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,29 +126,25 @@ impl CalculatorSyncHandler for CalculatorServer {
|
|||
|
||||
let res = if let Some(ref op) = w.op {
|
||||
if w.num1.is_none() || w.num2.is_none() {
|
||||
Err(
|
||||
InvalidOperation {
|
||||
what_op: Some(*op as i32),
|
||||
why: Some("no operands specified".to_owned()),
|
||||
},
|
||||
)
|
||||
Err(InvalidOperation {
|
||||
what_op: Some(*op as i32),
|
||||
why: Some("no operands specified".to_owned()),
|
||||
})
|
||||
} else {
|
||||
// so that I don't have to call unwrap() multiple times below
|
||||
let num1 = w.num1.as_ref().expect("operands checked");
|
||||
let num2 = w.num2.as_ref().expect("operands checked");
|
||||
|
||||
match *op {
|
||||
Operation::ADD => Ok(num1 + num2),
|
||||
Operation::SUBTRACT => Ok(num1 - num2),
|
||||
Operation::MULTIPLY => Ok(num1 * num2),
|
||||
Operation::DIVIDE => {
|
||||
Operation::Add => Ok(num1 + num2),
|
||||
Operation::Subtract => Ok(num1 - num2),
|
||||
Operation::Multiply => Ok(num1 * num2),
|
||||
Operation::Divide => {
|
||||
if *num2 == 0 {
|
||||
Err(
|
||||
InvalidOperation {
|
||||
what_op: Some(*op as i32),
|
||||
why: Some("divide by 0".to_owned()),
|
||||
},
|
||||
)
|
||||
Err(InvalidOperation {
|
||||
what_op: Some(*op as i32),
|
||||
why: Some("divide by 0".to_owned()),
|
||||
})
|
||||
} else {
|
||||
Ok(num1 / num2)
|
||||
}
|
||||
|
@ -152,7 +152,10 @@ impl CalculatorSyncHandler for CalculatorServer {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
Err(InvalidOperation::new(None, "no operation specified".to_owned()),)
|
||||
Err(InvalidOperation::new(
|
||||
None,
|
||||
"no operation specified".to_owned(),
|
||||
))
|
||||
};
|
||||
|
||||
// if the operation was successful log it
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue