Skip to content

Commit 36d2e86

Browse files
author
Jameson Ernst
committed
Fixes for 1.0 alpha
1 parent c843285 commit 36d2e86

File tree

9 files changed

+24
-24
lines changed

9 files changed

+24
-24
lines changed

examples/audio-whitenoise.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ fn main() {
3030
// false: Playback
3131
let mut device = match desired_spec.open_audio_device(None, false) {
3232
Ok(device) => device,
33-
Err(s) => panic!("{}", s)
33+
Err(s) => panic!("{:?}", s)
3434
};
3535

3636
// Show obtained AudioSpec
37-
println!("{}", device.get_spec());
37+
println!("{:?}", device.get_spec());
3838

3939
// Start playback
4040
device.resume();

src/sdl2/audio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,9 @@ impl<T: AudioFormatNum<T>, CB: AudioCallback<T>> AudioSpecDesired<T, CB> {
237237
}
238238

239239
fn callback_to_userdata(callback: CB) -> Box<AudioCallbackUserdata<CB>> {
240-
box AudioCallbackUserdata {
240+
Box::new(AudioCallbackUserdata {
241241
callback: callback
242-
}
242+
})
243243
}
244244

245245
/// Opens a new audio device given the desired parameters and callback.

src/sdl2/keycode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ pub enum KeyCode {
241241
Sleep = 1073742106,
242242
}
243243

244-
impl<S: hash::Writer> Hash<S> for KeyCode {
244+
impl<S: hash::Hasher + hash::Writer> Hash<S> for KeyCode {
245245
#[inline]
246246
fn hash(&self, state: &mut S) {
247247
(*self as i32).hash(state);

src/sdl2/macros.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
macro_rules! impl_raw_accessors(
2-
($($t:ty, $raw:ty);+) => (
2+
($(($t:ty, $raw:ty)),+) => (
33
$(
44
impl $t {
55
#[inline]
@@ -10,7 +10,7 @@ macro_rules! impl_raw_accessors(
1010
);
1111

1212
macro_rules! impl_owned_accessors(
13-
($($t:ty, $owned:ident);+) => (
13+
($(($t:ty, $owned:ident)),+) => (
1414
$(
1515
impl $t {
1616
#[inline]
@@ -21,7 +21,7 @@ macro_rules! impl_owned_accessors(
2121
);
2222

2323
macro_rules! impl_raw_constructor(
24-
($($t:ty -> $te:ident ($($r:ident:$rt:ty),+));+) => (
24+
($(($t:ty, $te:ident ($($r:ident:$rt:ty),+))),+) => (
2525
$(
2626
impl $t {
2727
#[inline]

src/sdl2/pixels.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub struct Palette {
77
raw: *const ll::SDL_Palette
88
}
99

10-
impl_raw_accessors!(Palette, *const ll::SDL_Palette);
10+
impl_raw_accessors!((Palette, *const ll::SDL_Palette));
1111

1212
#[derive(PartialEq, Clone, Copy)]
1313
pub enum Color {
@@ -59,8 +59,8 @@ pub struct PixelFormat {
5959
raw: *const ll::SDL_PixelFormat
6060
}
6161

62-
impl_raw_accessors!(PixelFormat, *const ll::SDL_PixelFormat);
63-
impl_raw_constructor!(PixelFormat -> PixelFormat (raw: *const ll::SDL_PixelFormat));
62+
impl_raw_accessors!((PixelFormat, *const ll::SDL_PixelFormat));
63+
impl_raw_constructor!((PixelFormat, PixelFormat (raw: *const ll::SDL_PixelFormat)));
6464

6565
#[derive(Copy, Clone, PartialEq, Show, FromPrimitive)]
6666
pub enum PixelFormatFlag {
@@ -136,7 +136,7 @@ impl PixelFormatFlag {
136136
PixelFormatFlag::Unknown | PixelFormatFlag::Index1LSB |
137137
PixelFormatFlag::Index1MSB | PixelFormatFlag::Index4LSB |
138138
PixelFormatFlag::Index4MSB
139-
=> panic!("not supported format: {}", *self),
139+
=> panic!("not supported format: {:?}", *self),
140140
}
141141
}
142142

@@ -172,7 +172,7 @@ impl PixelFormatFlag {
172172
PixelFormatFlag::Unknown | PixelFormatFlag::Index1LSB |
173173
PixelFormatFlag::Index1MSB | PixelFormatFlag::Index4LSB |
174174
PixelFormatFlag::Index4MSB
175-
=> panic!("not supported format: {}", *self),
175+
=> panic!("not supported format: {:?}", *self),
176176
}
177177
}
178178
}

src/sdl2/rwops.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ pub struct RWops {
1313
close_on_drop: bool
1414
}
1515

16-
impl_raw_accessors!(RWops, *const ll::SDL_RWops);
17-
impl_owned_accessors!(RWops, close_on_drop);
16+
impl_raw_accessors!((RWops, *const ll::SDL_RWops));
17+
impl_owned_accessors!((RWops, close_on_drop));
1818

1919
/// A structure that provides an abstract interface to stream I/O.
2020
impl RWops {

src/sdl2/scancode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ pub enum ScanCode {
247247
Num = 512,
248248
}
249249

250-
impl<S: hash::Writer> Hash<S> for ScanCode {
250+
impl<S: hash::Hasher + hash::Writer> Hash<S> for ScanCode {
251251
#[inline]
252252
fn hash(&self, state: &mut S) {
253253
(*self as i32).hash(state);

src/sdl2/surface.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ impl Drop for Surface {
3737
}
3838
}
3939

40-
impl_raw_accessors!(Surface, *const ll::SDL_Surface);
41-
impl_owned_accessors!(Surface, owned);
42-
impl_raw_constructor!(Surface -> Surface (raw: *const ll::SDL_Surface, owned: bool));
40+
impl_raw_accessors!((Surface, *const ll::SDL_Surface));
41+
impl_owned_accessors!((Surface, owned));
42+
impl_raw_constructor!((Surface, Surface (raw: *const ll::SDL_Surface, owned: bool)));
4343

4444
impl Surface {
4545
pub fn new(surface_flags: SurfaceFlag, width: int, height: int, bpp: int,

src/sdl2/video.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,17 +164,17 @@ pub struct Window {
164164
}
165165

166166
impl_raw_accessors!(
167-
GLContext, ll::SDL_GLContext;
168-
Window, *const ll::SDL_Window
167+
(GLContext, ll::SDL_GLContext),
168+
(Window, *const ll::SDL_Window)
169169
);
170170

171171
impl_owned_accessors!(
172-
GLContext, owned;
173-
Window, owned
172+
(GLContext, owned),
173+
(Window, owned)
174174
);
175175

176176
impl_raw_constructor!(
177-
Window -> Window (raw: *const ll::SDL_Window, owned: bool)
177+
(Window, Window (raw: *const ll::SDL_Window, owned: bool))
178178
);
179179

180180
impl Drop for Window {

0 commit comments

Comments
 (0)