mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
Made impl_raw_constructors more general
This commit is contained in:
+3
-13
@@ -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),+ }
|
||||
}
|
||||
}
|
||||
)+
|
||||
|
||||
Reference in New Issue
Block a user