mirror of
https://github.com/OMGeeky/tarpc.git
synced 2025-12-30 08:08:58 +01:00
@@ -6,8 +6,12 @@
|
||||
|
||||
*Disclaimer*: This is not an official Google product.
|
||||
|
||||
tarpc is an RPC framework for rust with a focus on ease of use. Defining and implementing an echo-like server can be done in just a few lines of code:
|
||||
tarpc is an RPC framework for rust with a focus on ease of use. Defining a service can be done in
|
||||
just a few lines of code, and most of the boilerplate of writing a server is taken care of for you.
|
||||
|
||||
[Documentation](https://google.github.io/tarpc)
|
||||
|
||||
## Example
|
||||
```rust
|
||||
#[macro_use]
|
||||
extern crate tarpc;
|
||||
|
||||
@@ -144,6 +144,7 @@ macro_rules! impl_deserialize {
|
||||
impl $crate::macros::serde::de::Visitor for __FieldVisitor {
|
||||
type Value = __Field;
|
||||
|
||||
#[inline]
|
||||
fn visit_usize<E>(&mut self, value: usize)
|
||||
-> ::std::result::Result<__Field, E>
|
||||
where E: $crate::macros::serde::de::Error,
|
||||
@@ -166,6 +167,7 @@ macro_rules! impl_deserialize {
|
||||
impl $crate::macros::serde::de::EnumVisitor for __Visitor {
|
||||
type Value = $impler;
|
||||
|
||||
#[inline]
|
||||
fn visit<__V>(&mut self, mut visitor: __V)
|
||||
-> ::std::result::Result<$impler, __V::Error>
|
||||
where __V: $crate::macros::serde::de::VariantVisitor
|
||||
|
||||
@@ -32,6 +32,7 @@ struct MapVisitor<'a, T: 'a> {
|
||||
}
|
||||
|
||||
impl <'a, T: Serialize> ser::MapVisitor for MapVisitor<'a, T> {
|
||||
#[inline]
|
||||
fn visit<S>(&mut self, serializer: &mut S) -> Result<Option<()>, S::Error>
|
||||
where S: Serializer
|
||||
{
|
||||
@@ -49,9 +50,15 @@ impl <'a, T: Serialize> ser::MapVisitor for MapVisitor<'a, T> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn len(&self) -> Option<usize> {
|
||||
Some(2)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Deserialize> Deserialize for Packet<T> {
|
||||
#[inline]
|
||||
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
|
||||
where D: Deserializer
|
||||
{
|
||||
@@ -65,6 +72,7 @@ struct Visitor<T>(PhantomData<T>);
|
||||
impl<T: Deserialize> de::Visitor for Visitor<T> {
|
||||
type Value = Packet<T>;
|
||||
|
||||
#[inline]
|
||||
fn visit_seq<V>(&mut self, mut visitor: V) -> Result<Packet<T>, V::Error>
|
||||
where V: de::SeqVisitor
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user