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