update proxy macro to support additional type params
This commit is contained in:
@@ -9,8 +9,8 @@ pub trait ApplySettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! proxy_apply_settings {
|
macro_rules! proxy_apply_settings {
|
||||||
($outer:ident) => (
|
($struct:ident $(, $targs:ident)*) => (
|
||||||
impl<T: ApplySettings> ApplySettings for $outer<T> {
|
impl<T: ApplySettings$(, $targs)*> ApplySettings for $struct<T$(, $targs)*> {
|
||||||
fn apply_local_settings(&mut self, set: &frame::SettingSet) -> Result<(), ConnectionError> {
|
fn apply_local_settings(&mut self, set: &frame::SettingSet) -> Result<(), ConnectionError> {
|
||||||
self.inner.apply_local_settings(set)
|
self.inner.apply_local_settings(set)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,23 @@ pub trait ControlPing {
|
|||||||
fn take_pong(&mut self) -> Option<PingPayload>;
|
fn take_pong(&mut self) -> Option<PingPayload>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// macro_rules! proxy_control_ping {
|
||||||
|
// ($outer:ident) => (
|
||||||
|
// impl<T: ControlPing> ControlPing for $outer<T> {
|
||||||
|
// fn start_ping(&mut self, body: PingPayload) -> StartSend<PingPayload, ConnectionError> {
|
||||||
|
// self.inner.start_ping(body)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// fn take_pong(&mut self) -> Option<PingPayload> {
|
||||||
|
// self.inner.take_pong()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
|
||||||
macro_rules! proxy_control_ping {
|
macro_rules! proxy_control_ping {
|
||||||
($outer:ident) => (
|
($struct:ident $(, $targs:ident)*) => (
|
||||||
impl<T: ControlPing> ControlPing for $outer<T> {
|
impl<T: ControlPing$(, $targs)*> ControlPing for $struct<T$(, $targs)*> {
|
||||||
fn start_ping(&mut self, body: PingPayload) -> StartSend<PingPayload, ConnectionError> {
|
fn start_ping(&mut self, body: PingPayload) -> StartSend<PingPayload, ConnectionError> {
|
||||||
self.inner.start_ping(body)
|
self.inner.start_ping(body)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ mod framed_write;
|
|||||||
mod ping_pong;
|
mod ping_pong;
|
||||||
mod ready;
|
mod ready;
|
||||||
mod settings;
|
mod settings;
|
||||||
mod state;
|
|
||||||
mod stream_recv_close;
|
mod stream_recv_close;
|
||||||
mod stream_recv_open;
|
mod stream_recv_open;
|
||||||
mod stream_send_close;
|
mod stream_send_close;
|
||||||
mod stream_send_open;
|
mod stream_send_open;
|
||||||
|
mod stream_state;
|
||||||
mod stream_states;
|
mod stream_states;
|
||||||
|
|
||||||
pub use self::connection::Connection;
|
pub use self::connection::Connection;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use {ConnectionError, Peer, StreamId};
|
use {ConnectionError, Peer, StreamId};
|
||||||
use error::Reason::{NoError, ProtocolError};
|
use error::Reason::{NoError, ProtocolError};
|
||||||
use proto::*;
|
use proto::*;
|
||||||
use proto::state::StreamState;
|
use proto::stream_state::StreamState;
|
||||||
|
|
||||||
use fnv::FnvHasher;
|
use fnv::FnvHasher;
|
||||||
use ordermap::OrderMap;
|
use ordermap::OrderMap;
|
||||||
@@ -317,24 +317,5 @@ impl<T, P, U> ReadySink for StreamStates<T, P>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Proxy.
|
proxy_apply_settings!(StreamStates, P);
|
||||||
impl<T: ApplySettings, P> ApplySettings for StreamStates<T, P> {
|
proxy_control_ping!(StreamStates, P);
|
||||||
fn apply_local_settings(&mut self, set: &frame::SettingSet) -> Result<(), ConnectionError> {
|
|
||||||
self.inner.apply_local_settings(set)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn apply_remote_settings(&mut self, set: &frame::SettingSet) -> Result<(), ConnectionError> {
|
|
||||||
self.inner.apply_remote_settings(set)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Proxy.
|
|
||||||
impl<T: ControlPing, P> ControlPing for StreamStates<T, P> {
|
|
||||||
fn start_ping(&mut self, body: PingPayload) -> StartSend<PingPayload, ConnectionError> {
|
|
||||||
self.inner.start_ping(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn take_pong(&mut self) -> Option<PingPayload> {
|
|
||||||
self.inner.take_pong()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user