mirror of
https://github.com/OMGeeky/tarpc.git
synced 2026-02-23 15:49:54 +01:00
Make tokio1 serde1 default features
This commit is contained in:
@@ -17,7 +17,7 @@ json-transport = { package = "tarpc-json-transport", version = "0.1", path = "..
|
|||||||
clap = "2.0"
|
clap = "2.0"
|
||||||
futures-preview = { version = "0.3.0-alpha.17" }
|
futures-preview = { version = "0.3.0-alpha.17" }
|
||||||
serde = { version = "1.0" }
|
serde = { version = "1.0" }
|
||||||
tarpc = { version = "0.18", path = "../tarpc", features = ["serde1", "tokio1"] }
|
tarpc = { version = "0.18", path = "../tarpc" }
|
||||||
tokio = "0.2.0-alpha.1"
|
tokio = "0.2.0-alpha.1"
|
||||||
env_logger = "0.6"
|
env_logger = "0.6"
|
||||||
|
|
||||||
|
|||||||
@@ -89,12 +89,12 @@ if [ "$?" == 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
try_run "Building ... " cargo build --color=always
|
try_run "Building ... " cargo build --no-default-features --color=always
|
||||||
try_run "Testing ... " cargo test --color=always
|
try_run "Testing ... " cargo test --no-default-features --color=always
|
||||||
try_run "Testing with all features enabled ... " cargo test --all-features --color=always
|
try_run "Testing with all features enabled ... " cargo test --all-features --color=always
|
||||||
for EXAMPLE in $(cargo run --example 2>&1 | grep ' ' | awk '{print $1}')
|
for EXAMPLE in $(cargo run --example 2>&1 | grep ' ' | awk '{print $1}')
|
||||||
do
|
do
|
||||||
try_run "Running example \"$EXAMPLE\" ... " cargo run --all-features --example $EXAMPLE
|
try_run "Running example \"$EXAMPLE\" ... " cargo run --example $EXAMPLE
|
||||||
done
|
done
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
use crate::context;
|
use crate::context;
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
use log::error;
|
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
/// Provides a [`Client`] backed by a transport.
|
/// Provides a [`Client`] backed by a transport.
|
||||||
@@ -143,6 +142,8 @@ where
|
|||||||
/// Helper method to spawn the dispatch on the default executor.
|
/// Helper method to spawn the dispatch on the default executor.
|
||||||
#[cfg(feature = "tokio1")]
|
#[cfg(feature = "tokio1")]
|
||||||
pub fn spawn(self) -> io::Result<C> {
|
pub fn spawn(self) -> io::Result<C> {
|
||||||
|
use log::error;
|
||||||
|
|
||||||
let dispatch = self
|
let dispatch = self
|
||||||
.dispatch
|
.dispatch
|
||||||
.unwrap_or_else(move |e| error!("Connection broken: {}", e));
|
.unwrap_or_else(move |e| error!("Connection broken: {}", e));
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ use futures::{
|
|||||||
task::{Context, Poll},
|
task::{Context, Poll},
|
||||||
};
|
};
|
||||||
use humantime::format_rfc3339;
|
use humantime::format_rfc3339;
|
||||||
use log::{debug, info, trace};
|
use log::{debug, trace};
|
||||||
use pin_utils::{unsafe_pinned, unsafe_unpinned};
|
use pin_utils::{unsafe_pinned, unsafe_unpinned};
|
||||||
use std::{
|
use std::{
|
||||||
fmt,
|
fmt,
|
||||||
@@ -663,6 +663,8 @@ where
|
|||||||
/// request handler onto the default executor.
|
/// request handler onto the default executor.
|
||||||
#[cfg(feature = "tokio1")]
|
#[cfg(feature = "tokio1")]
|
||||||
pub fn execute(self) -> impl Future<Output = ()> {
|
pub fn execute(self) -> impl Future<Output = ()> {
|
||||||
|
use log::info;
|
||||||
|
|
||||||
self.try_for_each(|request_handler| {
|
self.try_for_each(|request_handler| {
|
||||||
async {
|
async {
|
||||||
tokio::spawn(request_handler);
|
tokio::spawn(request_handler);
|
||||||
@@ -701,6 +703,8 @@ where
|
|||||||
type Output = ();
|
type Output = ();
|
||||||
|
|
||||||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> {
|
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> {
|
||||||
|
use log::info;
|
||||||
|
|
||||||
while let Some(channel) = ready!(self.as_mut().incoming().poll_next(cx)) {
|
while let Some(channel) = ready!(self.as_mut().incoming().poll_next(cx)) {
|
||||||
tokio::spawn(
|
tokio::spawn(
|
||||||
channel
|
channel
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ readme = "../README.md"
|
|||||||
description = "An RPC framework for Rust with a focus on ease of use."
|
description = "An RPC framework for Rust with a focus on ease of use."
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
default = ["serde1", "tokio1"]
|
||||||
serde1 = ["rpc/serde1", "tarpc-plugins/serde1", "serde", "serde/derive"]
|
serde1 = ["rpc/serde1", "tarpc-plugins/serde1", "serde", "serde/derive"]
|
||||||
tokio1 = ["rpc/tokio1"]
|
tokio1 = ["rpc/tokio1"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user