Unify wrap_impl macros

Use a different pattern rather than different macro
This commit is contained in:
Alexandre Bury 2015-05-19 16:53:50 -07:00
parent 191c2899ea
commit ecd3c96d20
4 changed files with 4 additions and 8 deletions

View File

@ -27,7 +27,7 @@ impl BoxView {
impl ViewWrapper for BoxView {
wrap_impl_box!(self.content);
wrap_impl!(self.content);
fn wrap_get_min_size(&self, _: SizeRequest) -> Vec2 {
self.size

View File

@ -34,7 +34,7 @@ impl KeyEventView {
impl ViewWrapper for KeyEventView {
wrap_impl_box!(self.content);
wrap_impl!(self.content);
fn wrap_on_key_event(&mut self, ch: i32) -> EventResult {
match self.content.on_key_event(ch) {

View File

@ -19,7 +19,7 @@ impl<T: View> SizedView<T> {
}
impl <T: View> ViewWrapper for SizedView<T> {
wrap_impl!(self.view);
wrap_impl!(&self.view);
fn wrap_layout(&mut self, size: Vec2) {
self.view.layout(size);

View File

@ -44,7 +44,7 @@ impl <T: ViewWrapper> View for T {
#[macro_export]
macro_rules! wrap_impl {
(self.$v:ident) => {
(&self.$v:ident) => {
fn get_view(&self) -> &View {
&self.$v
@ -54,10 +54,6 @@ macro_rules! wrap_impl {
&mut self.$v
}
};
}
#[macro_export]
macro_rules! wrap_impl_box {
(self.$v:ident) => {
fn get_view(&self) -> &View {