Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change module structure. #122

Merged
merged 14 commits into from
Mar 8, 2017
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ description = "An RPC framework for Rust with a focus on ease of use."
travis-ci = { repository = "google/tarpc" }

[dependencies]
bincode = "1.0.0-alpha2"
bincode = "1.0.0-alpha4"
byteorder = "1.0"
cfg-if = "0.1.0"
futures = "0.1.7"
Expand All @@ -38,6 +38,7 @@ chrono = "0.3"
env_logger = "0.3"
futures-cpupool = "0.1"
clap = "2.0"
service-fn = { git = "https://github.com/tokio-rs/service-fn" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer we pin to a specific hash if there's no crate. Is that OK or do you still want to track master?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


[target.'cfg(target_os = "macos")'.dev-dependencies]
security-framework = "0.1"
Expand Down
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ extern crate tarpc;

use std::sync::mpsc;
use std::thread;
use tarpc::{client, server};
use tarpc::client::sync::ClientExt;
use tarpc::sync::{client, server};
use tarpc::sync::client::ClientExt;
use tarpc::util::{FirstSocketAddr, Never};

service! {
Expand Down Expand Up @@ -109,8 +109,8 @@ extern crate tarpc;
extern crate tokio_core;

use futures::Future;
use tarpc::{client, server};
use tarpc::client::future::ClientExt;
use tarpc::future::{client, server};
use tarpc::future::client::ClientExt;
use tarpc::util::{FirstSocketAddr, Never};
use tokio_core::reactor;

Expand Down Expand Up @@ -180,8 +180,9 @@ extern crate tarpc;
extern crate tokio_core;

use futures::Future;
use tarpc::{client, server};
use tarpc::client::future::ClientExt;
use tarpc::future::{client, server};
use tarpc::future::client::ClientExt;
use tarpc::tls;
use tarpc::util::{FirstSocketAddr, Never};
use tokio_core::reactor;
use tarpc::native_tls::{Pkcs12, TlsAcceptor};
Expand Down Expand Up @@ -216,7 +217,7 @@ fn main() {
reactor.handle().spawn(server);
let options = client::Options::default()
.handle(reactor.handle())
.tls(client::tls::Context::new("foobar.com").unwrap());
.tls(tls::client::Context::new("foobar.com").unwrap());
reactor.run(FutureClient::connect(handle.addr(), options)
.map_err(tarpc::Error::from)
.and_then(|client| client.hello("Mom".to_string()))
Expand Down
4 changes: 2 additions & 2 deletions benches/latency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ extern crate env_logger;
extern crate futures;
extern crate tokio_core;

use tarpc::{client, server};
use tarpc::client::future::ClientExt;
use tarpc::future::{client, server};
use tarpc::future::client::ClientExt;
use tarpc::util::{FirstSocketAddr, Never};
#[cfg(test)]
use test::Bencher;
Expand Down
4 changes: 2 additions & 2 deletions examples/concurrency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ use std::{cmp, thread};
use std::sync::{Arc, mpsc};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::time::{Duration, Instant};
use tarpc::{client, server};
use tarpc::client::future::ClientExt;
use tarpc::future::{client, server};
use tarpc::future::client::ClientExt;
use tarpc::util::{FirstSocketAddr, Never};
use tokio_core::reactor;

Expand Down
6 changes: 3 additions & 3 deletions examples/pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use std::rc::Rc;
use std::thread;
use std::time::Duration;
use subscriber::FutureServiceExt as SubscriberExt;
use tarpc::{client, server};
use tarpc::client::future::ClientExt;
use tarpc::future::{client, server};
use tarpc::future::client::ClientExt;
use tarpc::util::{FirstSocketAddr, Message, Never};
use tokio_core::reactor;

Expand Down Expand Up @@ -61,7 +61,7 @@ impl Subscriber {
fn listen(id: u32,
handle: &reactor::Handle,
options: server::Options)
-> server::future::Handle {
-> server::Handle {
let (server_handle, server) = Subscriber { id: id }
.listen("localhost:0".first_socket_addr(), handle, options)
.unwrap();
Expand Down
4 changes: 2 additions & 2 deletions examples/readme_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use std::error::Error;
use std::fmt;
use std::sync::mpsc;
use std::thread;
use tarpc::{client, server};
use tarpc::client::sync::ClientExt;
use tarpc::sync::{client, server};
use tarpc::sync::client::ClientExt;

service! {
rpc hello(name: String) -> String | NoNameGiven;
Expand Down
4 changes: 2 additions & 2 deletions examples/readme_futures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ extern crate tarpc;
extern crate tokio_core;

use futures::Future;
use tarpc::{client, server};
use tarpc::client::future::ClientExt;
use tarpc::future::{client, server};
use tarpc::future::client::ClientExt;
use tarpc::util::{FirstSocketAddr, Never};
use tokio_core::reactor;

Expand Down
4 changes: 2 additions & 2 deletions examples/readme_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ extern crate tokio_core;

use std::sync::mpsc;
use std::thread;
use tarpc::{client, server};
use tarpc::client::sync::ClientExt;
use tarpc::sync::{client, server};
use tarpc::sync::client::ClientExt;
use tarpc::util::Never;

service! {
Expand Down
4 changes: 2 additions & 2 deletions examples/server_calling_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ extern crate tokio_core;
use add::{FutureService as AddFutureService, FutureServiceExt as AddExt};
use double::{FutureService as DoubleFutureService, FutureServiceExt as DoubleExt};
use futures::{BoxFuture, Future, Stream};
use tarpc::{client, server};
use tarpc::client::future::ClientExt as Fc;
use tarpc::future::{client, server};
use tarpc::future::client::ClientExt as Fc;
use tarpc::util::{FirstSocketAddr, Message, Never};
use tokio_core::reactor;

Expand Down
10 changes: 6 additions & 4 deletions examples/sync_server_calling_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use add::{SyncService as AddSyncService, SyncServiceExt as AddExt};
use double::{SyncService as DoubleSyncService, SyncServiceExt as DoubleExt};
use std::sync::mpsc;
use std::thread;
use tarpc::{client, server};
use tarpc::client::sync::ClientExt as Fc;
use tarpc::sync::{client, server};
use tarpc::sync::client::ClientExt as Fc;
use tarpc::util::{FirstSocketAddr, Message, Never};

pub mod add {
Expand Down Expand Up @@ -69,7 +69,8 @@ fn main() {
let (tx, rx) = mpsc::channel();
thread::spawn(move || {
let handle = AddServer.listen("localhost:0".first_socket_addr(),
server::Options::default()).unwrap();
server::Options::default())
.unwrap();
tx.send(handle.addr()).unwrap();
handle.run();
});
Expand All @@ -80,7 +81,8 @@ fn main() {
thread::spawn(move || {
let add_client = add::SyncClient::connect(add, client::Options::default()).unwrap();
let handle = DoubleServer::new(add_client)
.listen("localhost:0".first_socket_addr(), server::Options::default())
.listen("localhost:0".first_socket_addr(),
server::Options::default())
.unwrap();
tx.send(handle.addr()).unwrap();
handle.run();
Expand Down
4 changes: 2 additions & 2 deletions examples/throughput.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use std::sync::Arc;
use std::sync::mpsc;
use std::thread;
use std::time;
use tarpc::{client, server};
use tarpc::client::sync::ClientExt;
use tarpc::future::server;
use tarpc::sync::client::{self, ClientExt};
use tarpc::util::{FirstSocketAddr, Never};
use tokio_core::reactor;

Expand Down
5 changes: 3 additions & 2 deletions examples/two_clients.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ use bar::FutureServiceExt as BarExt;
use baz::FutureServiceExt as BazExt;
use std::sync::mpsc;
use std::thread;
use tarpc::{client, server};
use tarpc::client::sync::ClientExt;
use tarpc::future::server;
use tarpc::sync::client;
use tarpc::sync::client::ClientExt;
use tarpc::util::{FirstSocketAddr, Never};
use tokio_core::reactor;

Expand Down
Loading