mirror of
https://github.com/OMGeeky/tarpc.git
synced 2026-01-01 17:14:32 +01:00
Remove compat and transmute for they are no longer needed
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
use futures::compat::*;
|
||||
use futures_legacy::task::Spawn as Spawn01;
|
||||
|
||||
#[allow(dead_code)]
|
||||
struct Compat01As03SinkExposed<S, SinkItem> {
|
||||
inner: Spawn01<S>,
|
||||
buffer: Option<SinkItem>,
|
||||
close_started: bool,
|
||||
}
|
||||
|
||||
pub fn exposed_compat_exec<S, SinkItem, F, T>(input: &Compat01As03Sink<S, SinkItem>, f: F) -> T
|
||||
where
|
||||
F: FnOnce(&S) -> T,
|
||||
{
|
||||
let exposed = unsafe { std::mem::transmute::<_, &Compat01As03SinkExposed<S, SinkItem>>(input) };
|
||||
f(exposed.inner.get_ref())
|
||||
}
|
||||
@@ -24,8 +24,6 @@ use std::{
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
use tokio_tcp::{TcpListener, TcpStream};
|
||||
|
||||
mod compat;
|
||||
|
||||
/// A transport that serializes to, and deserializes from, a [`TcpStream`].
|
||||
#[derive(Debug)]
|
||||
pub struct Transport<S, Item, SinkItem> {
|
||||
@@ -100,11 +98,11 @@ where
|
||||
type SinkItem = SinkItem;
|
||||
|
||||
fn peer_addr(&self) -> io::Result<SocketAddr> {
|
||||
compat::exposed_compat_exec(&self.inner, |conn| conn.get_ref().peer_addr())
|
||||
self.inner.get_ref().get_ref().peer_addr()
|
||||
}
|
||||
|
||||
fn local_addr(&self) -> io::Result<SocketAddr> {
|
||||
compat::exposed_compat_exec(&self.inner, |conn| conn.get_ref().local_addr())
|
||||
self.inner.get_ref().get_ref().local_addr()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user