Skip to content

Commit

Permalink
obj-rs: Derive more std traits
Browse files Browse the repository at this point in the history
  • Loading branch information
simnalamburt committed Sep 22, 2024
1 parent 2c006b1 commit be7cd75
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion obj-rs/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl LoadError {
}

/// Enum to store the various types of errors that can cause loading an OBJ to fail.
#[derive(Copy, PartialEq, Eq, Clone, Debug)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub enum LoadErrorKind {
/// Met unexpected statement.
UnexpectedStatement,
Expand Down
2 changes: 1 addition & 1 deletion obj-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub fn load_obj<V: FromRawVertex<I>, T: BufRead, I>(input: T) -> ObjResult<Obj<V
}

/// 3D model object loaded from wavefront OBJ.
#[derive(Debug, Clone)]
#[derive(Clone, Eq, PartialEq, Hash, Debug, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Obj<V = Vertex, I = u16> {
/// Object's name.
Expand Down
1 change: 1 addition & 0 deletions obj-rs/src/raw/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ fn test_strip_commect() {

type StrippedLines<T> = Map<Lines<T>, fn(Result<String>) -> Result<String>>;

#[derive(Debug)]
pub struct Lexer<T> {
stripped_lines: StrippedLines<T>,
}
Expand Down
2 changes: 1 addition & 1 deletion obj-rs/src/raw/material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ fn parse_texture_map(args: &[&str]) -> ObjResult<MtlTextureMap> {
}

/// Low-level Rust binding for `.mtl` format *(incomplete)*.
#[derive(Clone, Debug)]
#[derive(Clone, PartialEq, Debug, Default)]
pub struct RawMtl {
/// Map from the material name to its properties
pub materials: HashMap<String, Material>,
Expand Down
10 changes: 5 additions & 5 deletions obj-rs/src/raw/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ impl Group {
}

/// Low-level Rust binding for `.obj` format.
#[derive(Clone, Debug)]
#[derive(Clone, PartialEq, Debug, Default)]
pub struct RawObj {
/// Name of the object.
pub name: Option<String>,
Expand Down Expand Up @@ -502,7 +502,7 @@ pub struct RawObj {
pub type Point = usize;

/// The `Line` type.
#[derive(PartialEq, Eq, Clone, Debug)]
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
pub enum Line {
/// A series of line segments which contain only the position data of each vertex
P(Vec<usize>),
Expand All @@ -512,7 +512,7 @@ pub enum Line {
}

/// The `Polygon` type.
#[derive(PartialEq, Eq, Clone, Debug)]
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
pub enum Polygon {
/// A polygon which contains only the position data of each vertex.
P(Vec<usize>),
Expand All @@ -525,7 +525,7 @@ pub enum Polygon {
}

/// A group which contains ranges of points, lines and polygons
#[derive(Clone, Debug)]
#[derive(Clone, Eq, PartialEq, Hash, Debug, Default)]
pub struct Group {
/// Multiple range of points
pub points: Vec<Range>,
Expand All @@ -536,7 +536,7 @@ pub struct Group {
}

/// A struct which represent `[start, end)` range.
#[derive(Copy, PartialEq, Eq, Clone, Debug)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default)]
pub struct Range {
/// The lower bound of the range (inclusive).
pub start: usize,
Expand Down

0 comments on commit be7cd75

Please sign in to comment.