diff --git a/src/console/mod.rs b/src/console/mod.rs index 4c684b6..4a054e1 100644 --- a/src/console/mod.rs +++ b/src/console/mod.rs @@ -203,6 +203,7 @@ impl Vars { } } +#[derive(Default)] pub struct Console { history: Vec, dirty: bool, diff --git a/src/ecs/mod.rs b/src/ecs/mod.rs index 719bf8d..c2ab443 100644 --- a/src/ecs/mod.rs +++ b/src/ecs/mod.rs @@ -53,6 +53,12 @@ pub struct Filter { bits: BSet, } +impl Default for Filter { + fn default() -> Self { + Self::new() + } +} + impl Filter { /// Creates an empty filter which matches everything pub fn new() -> Filter { @@ -106,6 +112,7 @@ struct EntityState { } /// Stores and manages a collection of entities. +#[derive(Default)] pub struct Manager { num_components: usize, entities: Vec<(Option, u32)>, diff --git a/src/gl/mod.rs b/src/gl/mod.rs index 9a100fb..a782d78 100644 --- a/src/gl/mod.rs +++ b/src/gl/mod.rs @@ -264,6 +264,7 @@ pub const NEAREST_MIPMAP_LINEAR: TextureValue = gl::NEAREST_MIPMAP_LINEAR as Tex pub const CLAMP_TO_EDGE: TextureValue = gl::CLAMP_TO_EDGE as TextureValue; /// `Texture` is a buffer of data used by fragment shaders. +#[derive(Default)] pub struct Texture(u32); impl Texture { @@ -510,6 +511,7 @@ pub type ShaderParameter = u32; pub const COMPILE_STATUS: ShaderParameter = gl::COMPILE_STATUS; pub const INFO_LOG_LENGTH: ShaderParameter = gl::INFO_LOG_LENGTH; +#[derive(Default)] pub struct Program(u32); impl Program { @@ -712,6 +714,7 @@ impl Attribute { // VertexArray is used to store state needed to render vertices. // This includes buffers, the format of the buffers and enabled // attributes. +#[derive(Default)] pub struct VertexArray(u32); impl VertexArray { @@ -772,6 +775,7 @@ pub const READ_ONLY: Access = gl::READ_ONLY; pub const WRITE_ONLY: Access = gl::WRITE_ONLY; /// `Buffer` is a storage for vertex data. +#[derive(Default)] pub struct Buffer(u32); impl Buffer { @@ -871,6 +875,7 @@ pub const COLOR_ATTACHMENT_1: Attachment = gl::COLOR_ATTACHMENT1; pub const COLOR_ATTACHMENT_2: Attachment = gl::COLOR_ATTACHMENT2; pub const DEPTH_ATTACHMENT: Attachment = gl::DEPTH_ATTACHMENT; +#[derive(Default)] pub struct Framebuffer(u32); pub fn check_framebuffer_status() { diff --git a/src/server/target.rs b/src/server/target.rs index fbb1ed4..c8c1ba4 100644 --- a/src/server/target.rs +++ b/src/server/target.rs @@ -11,6 +11,12 @@ pub struct Info { last_pos: Position, } +impl Default for Info { + fn default() -> Self { + Self::new() + } +} + impl Info { pub fn new() -> Info { Info { diff --git a/src/ui/mod.rs b/src/ui/mod.rs index fa63aaf..0091a62 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -282,6 +282,12 @@ pub struct Container { last_height: f64, } +impl Default for Container { + fn default() -> Self { + Self::new() + } +} + impl Container { pub fn new() -> Container { Container { @@ -677,6 +683,7 @@ macro_rules! element { } } + #[derive(Default)] pub struct $builder { $( $sname: Option<$sty>,