update for rust: Eq renames to PartialEq

This commit is contained in:
Andelf
2014-05-31 22:42:06 +08:00
parent cd274d0897
commit 660c82f463
14 changed files with 37 additions and 37 deletions
+3 -3
View File
@@ -7,7 +7,7 @@ struct Key {
ident: &'static str,
}
impl Ord for Key {
impl PartialOrd for Key {
fn lt (&self, other: &Key) -> bool {
if self.code < other.code {
true
@@ -17,7 +17,7 @@ impl Ord for Key {
}
}
impl Eq for Key {
impl PartialEq for Key {
fn eq (&self, other: &Key) -> bool {
if self.code == other.code {
true
@@ -310,7 +310,7 @@ use std::hash::sip::SipState;
use std::num::FromPrimitive;
use std::num::ToPrimitive;
#[deriving(Eq, TotalEq, Show)]
#[deriving(PartialEq, TotalEq, Show)]
pub enum KeyCode {
".as_bytes()));
for &entry in entries.iter() {
+3 -3
View File
@@ -7,7 +7,7 @@ struct ScanCode {
ident: &'static str,
}
impl Ord for ScanCode {
impl PartialOrd for ScanCode {
fn lt (&self, other: &ScanCode) -> bool {
if self.code < other.code {
true
@@ -17,7 +17,7 @@ impl Ord for ScanCode {
}
}
impl Eq for ScanCode {
impl PartialEq for ScanCode {
fn eq (&self, other: &ScanCode) -> bool {
if self.code == other.code {
true
@@ -317,7 +317,7 @@ use std::hash::sip::SipState;
use std::num::FromPrimitive;
use std::num::ToPrimitive;
#[deriving(Eq, TotalEq, Show)]
#[deriving(PartialEq, TotalEq, Show)]
pub enum ScanCode {
".as_bytes()));
for &entry in entries.iter() {
+2 -2
View File
@@ -142,7 +142,7 @@ pub static AudioS32SYS : AudioFormat = ll::AUDIO_S32SYS;
pub static AudioF32SYS : AudioFormat = ll::AUDIO_F32SYS;
#[repr(C)]
#[deriving(Clone, Eq, Hash, Show, FromPrimitive)]
#[deriving(Clone, PartialEq, Hash, Show, FromPrimitive)]
pub enum AudioStatus {
Stopped = ll::SDL_AUDIO_STOPPED as int,
Playing = ll::SDL_AUDIO_PLAYING as int,
@@ -314,7 +314,7 @@ impl AudioDevice {
}
}
#[deriving(Eq)] #[allow(raw_pointer_deriving)]
#[deriving(PartialEq)] #[allow(raw_pointer_deriving)]
pub struct AudioCVT {
raw: *mut ll::SDL_AudioCVT,
owned: bool,
+2 -2
View File
@@ -122,7 +122,7 @@ pub mod ll {
}
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum ControllerAxis {
InvalidAxis = ll::SDL_CONTROLLER_AXIS_INVALID,
LeftXAxis = ll::SDL_CONTROLLER_AXIS_LEFTX,
@@ -145,7 +145,7 @@ pub fn wrap_controller_axis(bitflags: u8) -> ControllerAxis {
}
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum ControllerButton {
InvalidButton = ll::SDL_CONTROLLER_BUTTON_INVALID,
AButton = ll::SDL_CONTROLLER_BUTTON_A,
+4 -4
View File
@@ -55,7 +55,7 @@ pub mod ll {
}
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum SystemCursor {
ArrowCursor = ll::SDL_SYSTEM_CURSOR_ARROW,
IBeamCursor = ll::SDL_SYSTEM_CURSOR_IBEAM,
@@ -71,7 +71,7 @@ pub enum SystemCursor {
HandCursor = ll::SDL_SYSTEM_CURSOR_HAND,
}
#[deriving(Eq)] #[allow(raw_pointer_deriving)]
#[deriving(PartialEq)] #[allow(raw_pointer_deriving)]
pub struct Cursor {
raw: *ll::SDL_Cursor,
owned: bool
@@ -134,7 +134,7 @@ impl Cursor {
}
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum Mouse {
LeftMouse,
MiddleMouse,
@@ -159,7 +159,7 @@ pub fn wrap_mouse(bitflags: u8) -> Mouse {
3 => RightMouse,
4 => X1Mouse,
5 => X2Mouse,
_ => UnknownMouse(bitflags)
_ => UnknownMouse(bitflags)
}
}
+4 -4
View File
@@ -87,14 +87,14 @@ pub mod ll {
pub fn SDL_MapRGBA(format: *SDL_PixelFormat, r: uint8_t, g: uint8_t, b: uint8_t, a: uint8_t) -> uint32_t;
}
}
#[deriving(Eq)] #[allow(raw_pointer_deriving)]
#[deriving(PartialEq)] #[allow(raw_pointer_deriving)]
pub struct Palette {
raw: *ll::SDL_Palette
}
impl_raw_accessors!(Palette, *ll::SDL_Palette)
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum Color {
RGB(u8, u8, u8),
RGBA(u8, u8, u8, u8)
@@ -132,7 +132,7 @@ impl rand::Rand for Color {
}
}
#[deriving(Eq)] #[allow(raw_pointer_deriving)]
#[deriving(PartialEq)] #[allow(raw_pointer_deriving)]
pub struct PixelFormat {
raw: *ll::SDL_PixelFormat
}
@@ -140,7 +140,7 @@ pub struct PixelFormat {
impl_raw_accessors!(PixelFormat, *ll::SDL_PixelFormat)
impl_raw_constructor!(PixelFormat -> PixelFormat (raw: *ll::SDL_PixelFormat))
#[deriving(Eq, Show, FromPrimitive)]
#[deriving(PartialEq, Show, FromPrimitive)]
pub enum PixelFormatFlag {
Unknown = ll::SDL_PIXELFORMAT_UNKNOWN as int,
Index1LSB = ll::SDL_PIXELFORMAT_INDEX1LSB as int,
+2 -2
View File
@@ -6,14 +6,14 @@ use std::mem;
use libc::c_int;
/// A structure that defines a two dimensional point.
#[deriving(Eq, Clone, Show)]
#[deriving(PartialEq, Clone, Show)]
pub struct Point {
pub x: i32,
pub y: i32
}
/// A structure that defines a rectangle, with the origin at the upper left.
#[deriving(Eq, Clone, Show)]
#[deriving(PartialEq, Clone, Show)]
pub struct Rect {
pub x: i32,
pub y: i32,
+6 -6
View File
@@ -143,7 +143,7 @@ pub enum RenderDriverIndex {
DriverIndex(int)
}
#[deriving(Eq, FromPrimitive)]
#[deriving(PartialEq, FromPrimitive)]
pub enum TextureAccess {
AccessStatic = ll::SDL_TEXTUREACCESS_STATIC as int,
AccessStreaming = ll::SDL_TEXTUREACCESS_STREAMING as int,
@@ -157,7 +157,7 @@ bitflags!(flags RendererFlags: u32 {
static TargetTexture = ll::SDL_RENDERER_TARGETTEXTURE as u32
})
#[deriving(Eq)]
#[deriving(PartialEq)]
pub struct RendererInfo {
pub name: String,
pub flags: RendererFlags,
@@ -166,7 +166,7 @@ pub struct RendererInfo {
pub max_texture_height: int
}
#[deriving(Eq, FromPrimitive)]
#[deriving(PartialEq, FromPrimitive)]
pub enum BlendMode {
BlendNone = ll::SDL_BLENDMODE_NONE as int,
BlendBlend = ll::SDL_BLENDMODE_BLEND as int,
@@ -174,7 +174,7 @@ pub enum BlendMode {
BlendMod = ll::SDL_BLENDMODE_MOD as int
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum RendererFlip {
FlipNone = ll::SDL_FLIP_NONE as int,
FlipHorizontal = ll::SDL_FLIP_HORIZONTAL as int,
@@ -201,7 +201,7 @@ impl RendererInfo {
}
}
#[deriving(Eq)] #[allow(raw_pointer_deriving)]
#[deriving(PartialEq)] #[allow(raw_pointer_deriving)]
pub struct Renderer<S> {
raw: *ll::SDL_Renderer,
parent: Option<S>,
@@ -592,7 +592,7 @@ pub struct TextureQuery {
pub height: int
}
#[deriving(Eq)] #[allow(raw_pointer_deriving)]
#[deriving(PartialEq)] #[allow(raw_pointer_deriving)]
pub struct Texture {
pub raw: *ll::SDL_Texture,
pub owned: bool
+1 -1
View File
@@ -42,7 +42,7 @@ pub mod ll {
}
}
#[deriving(Eq)] #[allow(raw_pointer_deriving)]
#[deriving(PartialEq)] #[allow(raw_pointer_deriving)]
pub struct RWops {
raw: *ll::SDL_RWops,
close_on_drop: bool
+1 -1
View File
@@ -74,7 +74,7 @@ bitflags!(flags InitFlag: u32 {
static InitEverything = ll::SDL_INIT_EVERYTHING
})
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum Error {
NoMemError = ll::SDL_ENOMEM as int,
ReadError = ll::SDL_EFREAD as int,
+1 -1
View File
@@ -83,7 +83,7 @@ bitflags!(flags SurfaceFlag: u32 {
static DontFree = ll::SDL_DONTFREE as u32
})
#[deriving(Eq)]
#[deriving(PartialEq)]
#[allow(raw_pointer_deriving)]
pub struct Surface {
raw: *ll::SDL_Surface,
+1 -1
View File
@@ -2,7 +2,7 @@ use std::ptr;
pub type TouchDevice = ll::SDL_TouchID;
#[deriving(Eq)]
#[deriving(PartialEq)]
pub struct Finger {
id: TouchDevice,
x: f32,
+1 -1
View File
@@ -22,7 +22,7 @@ pub mod ll {
}
/// A structure that contains information about the version of SDL in use.
#[deriving(Eq, Clone)]
#[deriving(PartialEq, Clone)]
pub struct Version {
/// major version
pub major: int,
+6 -6
View File
@@ -182,7 +182,7 @@ pub mod ll {
}
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum GLAttr {
GLRedSize = ll::SDL_GL_RED_SIZE as int,
GLGreenSize = ll::SDL_GL_GREEN_SIZE as int,
@@ -219,7 +219,7 @@ fn empty_sdl_display_mode() -> ll::SDL_DisplayMode {
}
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub struct DisplayMode {
pub format: u32,
pub w: int,
@@ -274,14 +274,14 @@ bitflags!(flags WindowFlags: u32 {
static Foreign = ll::SDL_WINDOW_FOREIGN as u32
})
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum FullscreenType {
FTOff = 0,
FTTrue = ll::SDL_WINDOW_FULLSCREEN as int,
FTDesktop = ll::SDL_WINDOW_FULLSCREEN_DESKTOP as int
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum WindowPos {
PosUndefined,
PosCentered,
@@ -296,7 +296,7 @@ fn unwrap_windowpos (pos: WindowPos) -> ll::SDL_WindowPos {
}
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub struct GLContext {
raw: ll::SDL_GLContext,
owned: bool
@@ -312,7 +312,7 @@ impl Drop for GLContext {
}
}
#[deriving(Eq)]
#[deriving(PartialEq)]
#[allow(raw_pointer_deriving)]
pub struct Window {
raw: *ll::SDL_Window,