mirror of
https://github.com/OMGeeky/tarpc.git
synced 2026-02-23 15:49:54 +01:00
Reexport/tokio serde (#332)
Re-export tokio_serde when the serde-transport feature is enabled.
This commit is contained in:
@@ -19,8 +19,6 @@ futures = "0.3"
|
|||||||
serde = { version = "1.0" }
|
serde = { version = "1.0" }
|
||||||
tarpc = { version = "0.23", path = "../tarpc", features = ["full"] }
|
tarpc = { version = "0.23", path = "../tarpc", features = ["full"] }
|
||||||
tokio = { version = "0.3", features = ["full"] }
|
tokio = { version = "0.3", features = ["full"] }
|
||||||
tokio-serde = { version = "0.7.1", features = ["json"] }
|
|
||||||
tokio-util = { version = "0.5", features = ["codec"] }
|
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "service"
|
name = "service"
|
||||||
|
|||||||
@@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
use clap::{App, Arg};
|
use clap::{App, Arg};
|
||||||
use std::{io, net::SocketAddr};
|
use std::{io, net::SocketAddr};
|
||||||
use tarpc::{client, context};
|
use tarpc::{client, context, tokio_serde::formats::Json};
|
||||||
use tokio_serde::formats::Json;
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> io::Result<()> {
|
async fn main() -> io::Result<()> {
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ use std::{
|
|||||||
use tarpc::{
|
use tarpc::{
|
||||||
context,
|
context,
|
||||||
server::{self, Channel, Handler},
|
server::{self, Channel, Handler},
|
||||||
|
tokio_serde::formats::Json,
|
||||||
};
|
};
|
||||||
use tokio_serde::formats::Json;
|
|
||||||
|
|
||||||
// This is the type that implements the generated World trait. It is the business logic
|
// This is the type that implements the generated World trait. It is the business logic
|
||||||
// and is used to start the server.
|
// and is used to start the server.
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ default = []
|
|||||||
|
|
||||||
serde1 = ["tarpc-plugins/serde1", "serde", "serde/derive"]
|
serde1 = ["tarpc-plugins/serde1", "serde", "serde/derive"]
|
||||||
tokio1 = ["tokio/rt-multi-thread"]
|
tokio1 = ["tokio/rt-multi-thread"]
|
||||||
serde-transport = ["tokio-serde", "tokio-util/codec"]
|
serde-transport = ["tokio-serde/json", "tokio-util/codec"]
|
||||||
tcp = ["tokio/net", "tokio/stream"]
|
tcp = ["tokio/net", "tokio/stream"]
|
||||||
|
|
||||||
full = ["serde1", "tokio1", "serde-transport", "tcp"]
|
full = ["serde1", "tokio1", "serde-transport", "tcp"]
|
||||||
|
|||||||
@@ -206,6 +206,9 @@ pub use rpc::*;
|
|||||||
#[cfg(feature = "serde1")]
|
#[cfg(feature = "serde1")]
|
||||||
pub use serde;
|
pub use serde;
|
||||||
|
|
||||||
|
#[cfg(feature = "serde-transport")]
|
||||||
|
pub use tokio_serde;
|
||||||
|
|
||||||
#[cfg(feature = "serde-transport")]
|
#[cfg(feature = "serde-transport")]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "serde-transport")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "serde-transport")))]
|
||||||
pub mod serde_transport;
|
pub mod serde_transport;
|
||||||
|
|||||||
Reference in New Issue
Block a user