diff --git a/examples/deferred/main.rs b/examples/deferred/main.rs index ef1c5289e87..a7271f0f204 100644 --- a/examples/deferred/main.rs +++ b/examples/deferred/main.rs @@ -729,7 +729,7 @@ fn main() { let mut debug_buf: Option = None; - let mut light_pos_vec: Vec<[f32; 4]> = range(0, NUM_LIGHTS).map(|_| { + let mut light_pos_vec: Vec<[f32; 4]> = (0 ..NUM_LIGHTS).map(|_| { [0.0, 0.0, 0.0, 0.0] }).collect(); diff --git a/examples/performance/main.rs b/examples/performance/main.rs index ee1a80cb0ec..51464cee1bc 100644 --- a/examples/performance/main.rs +++ b/examples/performance/main.rs @@ -153,8 +153,8 @@ fn gfx_main(mut glfw: glfw::Glfw, let start = precise_time_s() * 1000.; graphics.clear(clear_data, gfx::COLOR | gfx::DEPTH, &frame); - for x in range(-dimension, dimension) { - for y in range(-dimension, dimension) { + for x in (-dimension) ..dimension { + for y in (-dimension) ..dimension { let mut model = Matrix3::identity().mul_s(0.01f32).to_matrix4(); model.w = Vector4::new(x as f32 * 0.05, 0f32, @@ -321,8 +321,8 @@ fn gl_main(mut glfw: glfw::Glfw, gl.Clear(gl::COLOR_BUFFER_BIT); } - for x in range(-dimension, dimension) { - for y in range(-dimension, dimension) { + for x in (-dimension) ..dimension { + for y in (-dimension) ..dimension { let mut model = Matrix3::identity().mul_s(0.01f32).to_matrix4(); model.w = Vector4::new(x as f32 * 0.05, 0f32, diff --git a/examples/terrain/main.rs b/examples/terrain/main.rs index cc71d7405d7..f3ff718db29 100644 --- a/examples/terrain/main.rs +++ b/examples/terrain/main.rs @@ -53,7 +53,7 @@ impl Clone for Vertex { } } -impl fmt::Show for Vertex { +impl fmt::Debug for Vertex { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Pos({}, {}, {})", self.pos[0], self.pos[1], self.pos[2]) } diff --git a/src/device/attrib.rs b/src/device/attrib.rs index 423be83dfbd..d934317af03 100644 --- a/src/device/attrib.rs +++ b/src/device/attrib.rs @@ -28,7 +28,7 @@ pub type Stride = u8; pub type InstanceRate = u8; /// The signedness of an attribute. -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] #[repr(u8)] pub enum SignFlag { Signed, @@ -36,7 +36,7 @@ pub enum SignFlag { } /// Describes how an integer value is interpreted by the shader. -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] #[repr(u8)] pub enum IntSubType { Raw, // un-processed integer @@ -45,7 +45,7 @@ pub enum IntSubType { } /// The size of an integer attribute, in bits. -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] #[repr(u8)] pub enum IntSize { U8, @@ -54,7 +54,7 @@ pub enum IntSize { } /// Type of a floating point attribute on the shader side. -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] #[repr(u8)] pub enum FloatSubType { Default, // 32-bit @@ -62,7 +62,7 @@ pub enum FloatSubType { } /// The size of a floating point attribute, in bits. -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] #[repr(u8)] pub enum FloatSize { F16, @@ -71,7 +71,7 @@ pub enum FloatSize { } /// The type of an attribute. -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub enum Type { Int(IntSubType, IntSize, SignFlag), Float(FloatSubType, FloatSize), @@ -98,7 +98,7 @@ impl Type { } /// Complete format of a vertex attribute. -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub struct Format { /// Number of elements per vertex pub elem_count: Count, diff --git a/src/device/draw.rs b/src/device/draw.rs index 390f600b5d7..669deb3d88f 100644 --- a/src/device/draw.rs +++ b/src/device/draw.rs @@ -24,7 +24,7 @@ type Offset = u32; type Size = u32; /// The place of some data in the data buffer. -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] pub struct DataPointer(Offset, Size); /// A buffer of data accompanying the commands. It can be vertex data, texture @@ -61,7 +61,7 @@ impl DataBuffer { self.buf.reserve(size); unsafe { self.buf.set_len(offset + size); - slice::bytes::copy_memory(self.buf.slice_from_mut(offset), + slice::bytes::copy_memory(&mut self.buf[offset ..], slice::from_raw_buf(&(v.as_ptr() as *const u8), size)); } DataPointer(offset as Offset, size as Size) @@ -70,7 +70,7 @@ impl DataBuffer { /// Return a reference to a stored data object. pub fn get_ref(&self, data: DataPointer) -> &[u8] { let DataPointer(offset, size) = data; - self.buf.slice(offset as usize, offset as usize + size as usize) + &self.buf[offset as usize ..offset as usize + size as usize] } } diff --git a/src/device/lib.rs b/src/device/lib.rs index 88e913bd9e4..8e8d4ab4a35 100644 --- a/src/device/lib.rs +++ b/src/device/lib.rs @@ -142,7 +142,7 @@ impl<'a, T: Copy, D: Device> Drop for RWMapping<'a, T, D> { } /// A generic handle struct -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub struct Handle(T, I); impl Handle { @@ -160,7 +160,7 @@ impl Handle { } /// Type-safe buffer handle -#[derive(Copy, Show, PartialEq, Clone)] +#[derive(Copy, Debug, PartialEq, Clone)] pub struct BufferHandle { raw: RawBufferHandle, } @@ -242,7 +242,7 @@ pub fn as_byte_slice(slice: &[T]) -> &[u8] { } /// Features that the device supports. -#[derive(Copy, Show)] +#[derive(Copy, Debug)] #[allow(missing_docs)] // pretty self-explanatory fields! pub struct Capabilities { pub shader_model: shade::ShaderModel, @@ -264,7 +264,7 @@ pub struct Capabilities { } /// Describes what geometric primitives are created from vertex data. -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] #[repr(u8)] pub enum PrimitiveType { /// Each vertex represents a single point. @@ -296,7 +296,7 @@ pub type IndexType = attrib::IntSize; /// The nature of these hints make them very implementation specific. Different drivers on /// different hardware will handle them differently. Only careful profiling will tell which is the /// best to use for a specific buffer. -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] #[repr(u8)] pub enum BufferUsage { /// Once uploaded, this buffer will rarely change, but will be read from often. @@ -309,7 +309,7 @@ pub enum BufferUsage { } /// An information block that is immutable and associated with each buffer -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub struct BufferInfo { /// Usage hint pub usage: BufferUsage, @@ -322,7 +322,7 @@ pub struct BufferInfo { /// this particular representation may be used by different backends, /// such as OpenGL (prior to GLNG) and DirectX (prior to DX12) #[allow(missing_docs)] -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum Command { BindProgram(back::Program), BindArrayBuffer(back::ArrayBuffer), diff --git a/src/device/shade.rs b/src/device/shade.rs index 157b8dcc9ca..07dbd3c0e2f 100644 --- a/src/device/shade.rs +++ b/src/device/shade.rs @@ -25,32 +25,32 @@ use std::fmt; pub type Dimension = u8; /// Whether the sampler samples an array texture. -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum IsArray { Array, NoArray } /// Whether the sampler samples a shadow texture (texture with a depth comparison) -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum IsShadow { Shadow, NoShadow } /// Whether the sampler samples a multisample texture. -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum IsMultiSample { MultiSample, NoMultiSample } /// Whether the sampler samples a rectangle texture. /// /// Rectangle textures are the same as 2D textures, but accessed with absolute texture coordinates /// (as opposed to the usual, normalized to [0, 1]). -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum IsRect { Rect, NoRect } /// Whether the matrix is column or row major. -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum MatrixFormat { ColumnMajor, RowMajor } /// What texture type this sampler samples from. /// /// A single sampler cannot be used with multiple texture types. -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum SamplerType { /// Sample from a buffer. SamplerBuffer, @@ -66,7 +66,7 @@ pub enum SamplerType { /// Base type of this shader parameter. #[allow(missing_docs)] -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum BaseType { F32, F64, @@ -76,7 +76,7 @@ pub enum BaseType { } /// Number of components this parameter represents. -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum ContainerType { /// Scalar value Single, @@ -90,7 +90,7 @@ pub enum ContainerType { /// Which program stage this shader represents. #[allow(missing_docs)] -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum Stage { Vertex, Geometry, @@ -168,7 +168,7 @@ impl Clone for UniformValue { } } -impl fmt::Show for UniformValue { +impl fmt::Debug for UniformValue { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { UniformValue::I32(x) => write!(f, "ValueI32({:?})", x), @@ -208,7 +208,7 @@ impl fmt::Show for UniformValue { } /// Vertex information that a shader takes as input. -#[derive(Clone, PartialEq, Show)] +#[derive(Clone, PartialEq, Debug)] pub struct Attribute { /// Name of this attribute. pub name: String, @@ -223,7 +223,7 @@ pub struct Attribute { } /// Uniform, a type of shader parameter representing data passed to the program. -#[derive(Clone, PartialEq, Show)] +#[derive(Clone, PartialEq, Debug)] pub struct UniformVar { /// Name of this uniform. pub name: String, @@ -238,7 +238,7 @@ pub struct UniformVar { } /// A uniform block. -#[derive(Clone, PartialEq, Show)] +#[derive(Clone, PartialEq, Debug)] pub struct BlockVar { /// Name of this uniform block. pub name: String, @@ -249,7 +249,7 @@ pub struct BlockVar { } /// Sampler, a type of shader parameter representing a texture that can be sampled. -#[derive(Clone, PartialEq, Show)] +#[derive(Clone, PartialEq, Debug)] pub struct SamplerVar { /// Name of this sampler variable. pub name: String, @@ -262,7 +262,7 @@ pub struct SamplerVar { } /// Metadata about a program. -#[derive(Clone, PartialEq, Show)] +#[derive(Clone, PartialEq, Debug)] pub struct ProgramInfo { /// Attributes in the program. pub attributes: Vec, @@ -275,7 +275,7 @@ pub struct ProgramInfo { } /// Error type for trying to store a UniformValue in a UniformVar. -#[derive(Copy, Show)] +#[derive(Copy, Debug)] pub enum CompatibilityError { /// Array sizes differ between the value and the var (trying to upload a vec2 as a vec4, etc) ErrorArraySize, @@ -316,7 +316,7 @@ impl UniformVar { /// A type storing shader source for different graphics APIs and versions. #[allow(missing_docs)] -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub struct ShaderSource<'a> { pub glsl_120: Option<&'a [u8]>, pub glsl_130: Option<&'a [u8]>, @@ -327,7 +327,7 @@ pub struct ShaderSource<'a> { } /// An error type for creating programs. -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum CreateShaderError { /// The device does not support any of the shaders supplied. NoSupportedShaderProvided, @@ -337,7 +337,7 @@ pub enum CreateShaderError { /// Shader model supported by the device, corresponds to the HLSL shader models. #[allow(missing_docs)] -#[derive(Copy, Clone, PartialEq, PartialOrd, Show)] +#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)] pub enum ShaderModel { Unsupported, Version30, diff --git a/src/device/state.rs b/src/device/state.rs index 9802ecf31ad..5825b53f2e3 100644 --- a/src/device/state.rs +++ b/src/device/state.rs @@ -22,7 +22,7 @@ use std::fmt; use target; /// The winding order of a set of vertices. -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub enum WindingOrder { /// Clockwise winding order. Clockwise, @@ -38,12 +38,12 @@ pub type OffsetFactor = f32; pub type OffsetUnits = u32; /// How to offset vertices in screen space, if at all. -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub struct Offset(pub OffsetFactor, pub OffsetUnits); /// Which face, if any, to cull. #[allow(missing_docs)] -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum CullMode { Nothing, Front, @@ -51,7 +51,7 @@ pub enum CullMode { } /// How to rasterize a primitive. -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum RasterMethod { /// Rasterize as a point. Point, @@ -63,7 +63,7 @@ pub enum RasterMethod { /// Primitive rasterization state. Note that GL allows different raster /// method to be used for front and back, while this abstraction does not. -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub struct Primitive { /// Which vertex winding is considered to be the front face for culling. pub front_face: WindingOrder, @@ -94,13 +94,13 @@ impl Default for Primitive { } /// Multi-sampling rasterization mode -#[derive(Eq, Ord, PartialEq, PartialOrd, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Copy, Clone, Debug)] pub struct MultiSample; //sample_mask: u16, //alpha_to_coverage: bool, /// A pixel-wise comparison function. -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub enum Comparison { /// `false` Never, @@ -122,7 +122,7 @@ pub enum Comparison { /// Stencil mask operation. #[allow(missing_docs)] -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub enum StencilOp { /// Keep the current value in the stencil buffer (no change). Keep, @@ -143,7 +143,7 @@ pub enum StencilOp { } /// Complete stencil state for a given side of a face. -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub struct StencilSide { /// Comparison function to use to determine if the stencil test passes. pub fun: Comparison, @@ -178,14 +178,14 @@ impl Default for StencilSide { /// Complete stencil state, specifying how to handle the front and back side of a face. #[allow(missing_docs)] -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub struct Stencil { pub front: StencilSide, pub back: StencilSide, } /// Depth test state. -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub struct Depth { /// Comparison function to use. pub fun: Comparison, @@ -203,7 +203,7 @@ impl Default for Depth { } #[allow(missing_docs)] -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub enum Equation { Add, Sub, @@ -213,14 +213,14 @@ pub enum Equation { } #[allow(missing_docs)] -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub enum InverseFlag { Normal, Inverse, } #[allow(missing_docs)] -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub enum BlendValue { Zero, SourceColor, @@ -233,11 +233,11 @@ pub enum BlendValue { } #[allow(missing_docs)] -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub struct Factor(pub InverseFlag, pub BlendValue); #[allow(missing_docs)] -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub struct BlendChannel { pub equation: Equation, pub source: Factor, @@ -290,7 +290,7 @@ impl Clone for Blend { } } -impl fmt::Show for Blend { +impl fmt::Debug for Blend { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Blend {{ color: {:?}, alpha: {:?}, value: {:?} }}", self.color, self.alpha, &self.value[]) @@ -308,7 +308,7 @@ bitflags!( } ); -impl fmt::Show for ColorMask { +impl fmt::Debug for ColorMask { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let values = [ (RED, "Red" ), diff --git a/src/device/target.rs b/src/device/target.rs index 9d01a91ff3e..1628d527fe1 100644 --- a/src/device/target.rs +++ b/src/device/target.rs @@ -29,7 +29,7 @@ pub type Stencil = u8; /// A screen space rectangle #[allow(missing_docs)] -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub struct Rect { pub x: u16, pub y: u16, @@ -53,7 +53,7 @@ bitflags!( } ); -impl fmt::Show for Mask { +impl fmt::Debug for Mask { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Mask({})", self.bits()) } @@ -80,7 +80,7 @@ impl Clone for ClearData { } } -impl fmt::Show for ClearData { +impl fmt::Debug for ClearData { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "ClearData {{ color: {:?}, depth: {:?}, stencil: {:?} }}", @@ -90,7 +90,7 @@ impl fmt::Show for ClearData { /// Type of the frame buffer access #[repr(u8)] -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum Access { /// Draw access Draw, @@ -100,7 +100,7 @@ pub enum Access { /// When rendering, each "output" of the fragment shader goes to a specific target. A `Plane` can /// be bound to a target, causing writes to that target to affect the `Plane`. -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum Target { /// Color data. /// diff --git a/src/device/tex.rs b/src/device/tex.rs index 2002f09e72a..04a5b6f9de5 100644 --- a/src/device/tex.rs +++ b/src/device/tex.rs @@ -28,7 +28,7 @@ use std::fmt; use state; /// Surface creation/update error. -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum SurfaceError { /// Failed to map a given format to the device UnsupportedSurfaceFormat, @@ -47,7 +47,7 @@ pub enum TextureError { IncorrectTextureSize(usize), } -impl fmt::Show for TextureError { +impl fmt::Debug for TextureError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { &TextureError::UnsupportedTextureFormat => @@ -85,7 +85,7 @@ pub type NumSamples = u8; pub type NumFragments = u8; /// Describes the configuration of samples inside each texel. -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub enum AaMode { /// MultiSampled Anti-Aliasing Msaa(NumSamples), @@ -94,7 +94,7 @@ pub enum AaMode { } /// Describes the color components of each texel. -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] #[repr(u8)] pub enum Components { /// Red only @@ -108,7 +108,7 @@ pub enum Components { } /// Describes the layout of each texel within a surface/texture. -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub enum Format { /// Floating point. Float(Components, ::attrib::FloatSize), @@ -137,7 +137,7 @@ pub enum Format { } /// Codec used to compress image data. -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] #[allow(non_camel_case_types)] pub enum Compression { /// Use the EXT2 algorithm on 3 components. @@ -176,7 +176,7 @@ pub static RGBA8: Format = Format::Unsigned(Components::RGBA, 8, IntSubType::Nor /// Describes the storage of a surface #[allow(missing_docs)] -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub struct SurfaceInfo { pub width: u16, pub height: u16, @@ -194,7 +194,7 @@ pub struct SurfaceInfo { /// textures. Similarly for trilinear, it is really Quadralinear(?) for 3D /// textures. Alas, these names are simple, and match certain intuitions /// ingrained by many years of public use of inaccurate terminology. -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub enum FilterMethod { /// The dumbest filtering possible, nearest-neighbor interpolation. Scale, @@ -215,7 +215,7 @@ pub enum FilterMethod { /// extended in the future. Note that a single texture can *only* ever be of /// one kind. A texture created as `Texture2D` will forever be `Texture2D`. // TODO: "Texture views" let you get around that limitation. -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub enum TextureKind { /// A single row of texels. Texture1D, @@ -242,7 +242,7 @@ pub enum TextureKind { } /// The face of a cube texture to do an operation on. -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] #[allow(missing_docs)] pub enum CubeFace { PosZ, @@ -271,7 +271,7 @@ impl TextureKind { /// Textures larger than 1024px in any dimension are unlikely to be supported /// by mobile platforms. #[allow(missing_docs)] -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub struct TextureInfo { pub width: u16, pub height: u16, @@ -287,7 +287,7 @@ pub struct TextureInfo { /// Describes a subvolume of a texture, which image data can be uploaded into. #[allow(missing_docs)] -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub struct ImageInfo { pub xoffset: u16, pub yoffset: u16, @@ -378,7 +378,7 @@ impl ImageInfo { } /// Specifies how texture coordinates outside the range `[0, 1]` are handled. -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub enum WrapMode { /// Tile the texture. That is, sample the coordinate modulo `1.0`. This is /// the default. @@ -390,7 +390,7 @@ pub enum WrapMode { } /// Specified how the Comparison operator should be used when sampling -#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)] +#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)] pub enum ComparisonMode { /// the default, don't use this feature. NoComparison, @@ -400,7 +400,7 @@ pub enum ComparisonMode { /// Specifies how to sample from a texture. // TODO: document the details of sampling. -#[derive(PartialEq, PartialOrd, Copy, Clone, Show)] +#[derive(PartialEq, PartialOrd, Copy, Clone, Debug)] pub struct SamplerInfo { /// Filter method to use. pub filtering: FilterMethod, diff --git a/src/gfx_macros/shader_param.rs b/src/gfx_macros/shader_param.rs index 6971f984235..c0a57e5f111 100644 --- a/src/gfx_macros/shader_param.rs +++ b/src/gfx_macros/shader_param.rs @@ -20,14 +20,14 @@ use syntax::parse::token; use syntax::ptr::P; use syntax::ext::base::ItemDecorator; -#[derive(Copy, PartialEq, Show)] +#[derive(Copy, PartialEq, Debug)] enum Param { Uniform, Block, Texture, } -#[derive(Copy, Show)] +#[derive(Copy, Debug)] enum ParamError { DeprecatedTexture, } diff --git a/src/gfx_macros/vertex_format.rs b/src/gfx_macros/vertex_format.rs index a7f64b922fe..388d6e5c8c0 100644 --- a/src/gfx_macros/vertex_format.rs +++ b/src/gfx_macros/vertex_format.rs @@ -40,7 +40,7 @@ enum Modifier { AsDouble, } -impl fmt::Show for Modifier { +impl fmt::Debug for Modifier { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { Modifier::Normalized => write!(f, "normalized"), diff --git a/src/gl_device/info.rs b/src/gl_device/info.rs index 4d215e62275..e312ef2e50c 100644 --- a/src/gl_device/info.rs +++ b/src/gl_device/info.rs @@ -80,7 +80,7 @@ impl Version { /// resulting in an `Err`. pub fn parse(src: &'static str) -> Result { let (version, vendor_info) = match src.find(' ') { - Some(i) => (src.slice_to(i), src.slice_from(i + 1)), + Some(i) => (&src[..i], &src[(i + 1)..]), None => (src, ""), }; @@ -103,7 +103,7 @@ impl Version { } } -impl fmt::Show for Version { +impl fmt::Debug for Version { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match (self.major, self.minor, self.revision, self.vendor_info) { (major, minor, Some(revision), "") => @@ -139,11 +139,11 @@ fn get_usize(gl: &gl::Gl, name: gl::types::GLenum) -> usize { } unsafe fn c_str_as_static_str(c_str: *const i8) -> &'static str { - mem::transmute(str::from_utf8(ffi::c_str_to_bytes(&c_str)).unwrap()) + mem::transmute(str::from_utf8(ffi::c_str_to_bytes(&c_str)).unwrap()) } /// A unique platform identifier that does not change between releases -#[derive(Copy, Eq, PartialEq, Show)] +#[derive(Copy, Eq, PartialEq, Debug)] pub struct PlatformName { /// The company responsible for the OpenGL implementation pub vendor: &'static str, @@ -161,7 +161,7 @@ impl PlatformName { } /// OpenGL implementation information -#[derive(Show)] +#[derive(Debug)] pub struct Info { /// The platform identifier pub platform_name: PlatformName, diff --git a/src/gl_device/lib.rs b/src/gl_device/lib.rs index 1012c7f86ae..a893976cb9f 100644 --- a/src/gl_device/lib.rs +++ b/src/gl_device/lib.rs @@ -59,7 +59,7 @@ pub type Surface = gl::types::GLuint; pub type Sampler = gl::types::GLuint; pub type Texture = gl::types::GLuint; -#[derive(Copy, Eq, PartialEq, Show)] +#[derive(Copy, Eq, PartialEq, Debug)] pub enum GlError { NoError, InvalidEnum, diff --git a/src/gl_device/shade.rs b/src/gl_device/shade.rs index e08319ddc2a..eb1b2bc5e19 100644 --- a/src/gl_device/shade.rs +++ b/src/gl_device/shade.rs @@ -259,7 +259,7 @@ fn query_parameters(gl: &gl::Gl, caps: &::Capabilities, prog: super::Program) -> gl.GetActiveUniform(prog, i, max_len, &mut length, &mut size, &mut storage, raw); gl.GetUniformLocation(prog, raw as *const gl::types::GLchar) }; - let real_name = (&name[]).slice_to(length as usize).to_string(); + let real_name = name[..length as usize].to_string(); match StorageType::new(storage) { Var(base, container) => { info!("\t\tUniform[{:?}] = '{:?}'\t{:?}\t{:?}", loc, real_name, base, container); diff --git a/src/render/batch.rs b/src/render/batch.rs index eb93cc1ed24..af4640ae081 100644 --- a/src/render/batch.rs +++ b/src/render/batch.rs @@ -27,7 +27,7 @@ use shade::{ParameterError, ShaderParam}; use state::DrawState; /// An error with a defined Mesh. -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub enum MeshError { /// A required attribute was missing. AttributeMissing(String), @@ -38,7 +38,7 @@ pub enum MeshError { } /// An error occurring at batch creation -#[derive(Clone, Show)] +#[derive(Clone, Debug)] pub enum BatchError { /// Error connecting mesh attributes Mesh(MeshError), @@ -125,7 +125,7 @@ impl> Batch for OwnedBatch { type Index = u16; -//#[derive(PartialEq, Eq, PartialOrd, Ord, Show)] +//#[derive(PartialEq, Eq, PartialOrd, Ord, Debug)] struct Id(Index); impl Copy for Id {} @@ -137,7 +137,7 @@ impl Id { } } -impl fmt::Show for Id { +impl fmt::Debug for Id { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let Id(i) = *self; write!(f, "Id({})", i) @@ -212,7 +212,7 @@ pub struct RefBatch { state_id: Id, } -impl fmt::Show for RefBatch { +impl fmt::Debug for RefBatch { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "RefBatch(mesh: {:?}, slice: {:?}, program: {:?}, state: {:?})", self.mesh_id, self.slice, self.program_id, self.state_id) diff --git a/src/render/lib.rs b/src/render/lib.rs index 8c26729283b..25bbeb9cb62 100644 --- a/src/render/lib.rs +++ b/src/render/lib.rs @@ -44,7 +44,7 @@ pub mod state; pub mod target; /// Program linking error -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum ProgramError { /// Unable to compile the vertex shader Vertex(CreateShaderError), diff --git a/src/render/mesh.rs b/src/render/mesh.rs index 39ed4d5a5f3..5b3ec9205a5 100644 --- a/src/render/mesh.rs +++ b/src/render/mesh.rs @@ -25,7 +25,7 @@ use device::{PrimitiveType, BufferHandle, VertexCount}; use device::attrib; /// Describes a single attribute of a vertex buffer, including its type, name, etc. -#[derive(Clone, PartialEq, Show)] +#[derive(Clone, PartialEq, Debug)] pub struct Attribute { /// A name to match the shader input pub name: String, @@ -43,7 +43,7 @@ pub trait VertexFormat { } /// Describes geometry to render. -#[derive(Clone, PartialEq, Show)] +#[derive(Clone, PartialEq, Debug)] pub struct Mesh { /// Number of vertices in the mesh. pub num_vertices: device::VertexCount, @@ -96,7 +96,7 @@ impl Mesh { /// The `prim_type` defines how the mesh contents are interpreted. /// For example, `Point` typed vertex slice can be used to do shape /// blending, while still rendereing it as an indexed `TriangleList`. -#[derive(Copy, Clone, Show)] +#[derive(Copy, Clone, Debug)] pub struct Slice { /// Start index of vertices to draw. pub start: VertexCount, @@ -109,7 +109,7 @@ pub struct Slice { } /// Source of vertex ordering for a slice -#[derive(Copy, Clone, Show)] +#[derive(Copy, Clone, Debug)] pub enum SliceKind { /// Render vertex data directly from the `Mesh`'s buffer. Vertex, @@ -184,7 +184,7 @@ impl ToSlice for BufferHandle { } /// Describes kinds of errors that may occur in the mesh linking -#[derive(Clone, Copy, Show)] +#[derive(Clone, Copy, Debug)] pub enum LinkError { /// An attribute index is out of supported bounds MeshAttribute(usize), diff --git a/src/render/shade.rs b/src/render/shade.rs index 0c67e94d442..56afcf12237 100644 --- a/src/render/shade.rs +++ b/src/render/shade.rs @@ -76,7 +76,7 @@ pub struct ParamValues<'a> { } /// An error type on either the parameter storage or the program side -#[derive(Clone, PartialEq, Show)] +#[derive(Clone, PartialEq, Debug)] pub enum ParameterError { /// Internal error ParameterGeneralMismatch, diff --git a/src/render/state.rs b/src/render/state.rs index 04f44841f1e..2f04bd8894e 100644 --- a/src/render/state.rs +++ b/src/render/state.rs @@ -21,7 +21,7 @@ use device::state::{BlendValue, CullMode, Equation, InverseFlag, RasterMethod, S use device::target::{Rect, Stencil}; /// An assembly of states that affect regular draw calls -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub struct DrawState { /// How to rasterize geometric primitives. pub primitive: state::Primitive, @@ -42,7 +42,7 @@ pub struct DrawState { } /// Blend function presets for ease of use. -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum BlendPreset { /// When combining two fragments, add their values together, saturating at 1.0 Additive, diff --git a/src/render/target.rs b/src/render/target.rs index 3e7749c8729..ca3a2e8a497 100644 --- a/src/render/target.rs +++ b/src/render/target.rs @@ -16,7 +16,7 @@ use device; -#[derive(Copy, Clone, PartialEq, Show)] +#[derive(Copy, Clone, PartialEq, Debug)] /// A single buffer that can be bound to a render target. pub enum Plane { /// Render to a `Surface` (corresponds to a renderbuffer in GL). @@ -38,7 +38,7 @@ impl Plane { } /// A complete `Frame`, which is the result of rendering. -#[derive(Clone, PartialEq, Show)] +#[derive(Clone, PartialEq, Debug)] pub struct Frame { /// The width of the viewport. pub width: u16,