diff --git a/src/proto/apply_settings.rs b/src/proto/apply_settings.rs index 990443f..214a5ad 100644 --- a/src/proto/apply_settings.rs +++ b/src/proto/apply_settings.rs @@ -9,8 +9,8 @@ pub trait ApplySettings { } macro_rules! proxy_apply_settings { - ($outer:ident) => ( - impl ApplySettings for $outer { + ($struct:ident $(, $targs:ident)*) => ( + impl ApplySettings for $struct { fn apply_local_settings(&mut self, set: &frame::SettingSet) -> Result<(), ConnectionError> { self.inner.apply_local_settings(set) } diff --git a/src/proto/control_ping.rs b/src/proto/control_ping.rs index e605d27..907231a 100644 --- a/src/proto/control_ping.rs +++ b/src/proto/control_ping.rs @@ -6,9 +6,23 @@ pub trait ControlPing { fn take_pong(&mut self) -> Option; } +// macro_rules! proxy_control_ping { +// ($outer:ident) => ( +// impl ControlPing for $outer { +// fn start_ping(&mut self, body: PingPayload) -> StartSend { +// self.inner.start_ping(body) +// } + +// fn take_pong(&mut self) -> Option { +// self.inner.take_pong() +// } +// } +// ) +// } + macro_rules! proxy_control_ping { - ($outer:ident) => ( - impl ControlPing for $outer { + ($struct:ident $(, $targs:ident)*) => ( + impl ControlPing for $struct { fn start_ping(&mut self, body: PingPayload) -> StartSend { self.inner.start_ping(body) } diff --git a/src/proto/mod.rs b/src/proto/mod.rs index 57b8387..ecfa346 100644 --- a/src/proto/mod.rs +++ b/src/proto/mod.rs @@ -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; diff --git a/src/proto/stream_states.rs b/src/proto/stream_states.rs index fa2aac5..7feb908 100644 --- a/src/proto/stream_states.rs +++ b/src/proto/stream_states.rs @@ -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 ReadySink for StreamStates } } -/// Proxy. -impl ApplySettings for StreamStates { - 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 ControlPing for StreamStates { - fn start_ping(&mut self, body: PingPayload) -> StartSend { - self.inner.start_ping(body) - } - - fn take_pong(&mut self) -> Option { - self.inner.take_pong() - } -} +proxy_apply_settings!(StreamStates, P); +proxy_control_ping!(StreamStates, P);