Made impl_raw_constructors more general

This commit is contained in:
Vladimir Matveev
2014-05-23 19:26:20 +04:00
parent d20835baa4
commit 75ab435dac
+3 -13
View File
@@ -23,22 +23,12 @@ macro_rules! impl_owned_accessors(
)
macro_rules! impl_raw_constructor(
($($t:ty -> $te:ident ($r:ident:$rt:ty));+) => (
($($t:ty -> $te:ident ($($r:ident:$rt:ty),+));+) => (
$(
impl $t {
#[inline]
pub unsafe fn new_from_raw($r:$rt) -> $t {
$te { $r: $r }
}
}
)+
);
($($t:ty -> $te:ident ($r:ident:$rt:ty, $o:ident:$ot:ty));+) => (
$(
impl $t {
#[inline]
pub unsafe fn new_from_raw($r:$rt, $o:$ot) -> $t {
$te { $r: $r, $o: $o }
pub unsafe fn new_from_raw($($r:$rt),+) -> $t {
$te { $($r: $r),+ }
}
}
)+