Skip to content

Instantly share code, notes, and snippets.

@tbillington
Last active August 29, 2015 14:05
Show Gist options
  • Save tbillington/8ac7dc5722322c901ba0 to your computer and use it in GitHub Desktop.
Save tbillington/8ac7dc5722322c901ba0 to your computer and use it in GitHub Desktop.
pub enum LineType {
GeometericVertexLine(GeometericVertex),
FaceLine(Face),
Failed,
Unused,
}
// Geometric vertex (v)
pub struct GeometericVertex {
pub x: f64,
pub y: f64,
pub z: f64,
}
// Generic function to pull the numeric data from a line in an obj file
pub fn extract_line_data<T: from_str::FromStr>(line: &str) -> Vec<T> {
line.trim().split(' ').filter_map(from_str).collect()
}
fn make_geometric_vertex<T: Index<uint,f64>>(data: T) -> GeometericVertex {
GeometericVertex { x: data[0], y: data[1], z: data[2] }
}
fn vert_from_reg(line: &str) -> LineType {
GeometericVertexLine(make_geometric_vertex(extract_line_data(line)))
}
E:\Github\Rusticle\src\types\utils.rs:60:48: 60:65 error: cannot determine a type for this bounded type parameter: unconstrained type
E:\Github\Rusticle\src\types\utils.rs:60 GeometericVertexLine(make_geometric_vertex(extract_line_data(line)))
^~~~~~~~~~~~~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment