This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn line_data<T: std::from_str::FromStr>(line: &str) -> [T, ..3] { | |
let iter = line.trim().split(' ').filter_map(|s| from_str::<T>(s)).collect(); | |
[iter.next().unwrap(), iter.next().unwrap(), iter.next().unwrap()] | |
} | |
line 3 : error: the type of this value must be known in this context | |
[iter.next().unwrap(), iter.next().unwrap(), iter.next().unwrap()] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn line_data<T: std::from_str::FromStr>(line: &str) -> Vec<T> { | |
line.trim().split(' ').filter_map(|s| from_str::<T>(s)).collect() | |
} | |
fn parse_line(line: &str) -> LineType { | |
let first_character = line.chars().next(); | |
match first_character { | |
Some(character) => match character { | |
'v' => { | |
let line_data = line_data(line); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn line_data<T>(line: &str) -> Vec<T> { | |
line.trim().split(' ').filter_map(|s| from_str::<T>(s)).collect() | |
} | |
error: failed to find an implementation of trait std::from_str::FromStr for T |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn linked_face(vertexes: &[Rc<RefCell<Vertex>>], face: UnlinkedFace) -> Option<RefCell<Face>> { | |
Some(RefCell::new(Face { | |
a: match vertexes.get(face.a) { | |
Some(x) => x.clone(), | |
None => return None | |
}, | |
b: match vertexes.get(face.b) { | |
Some(x) => x.clone(), | |
None => return None | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn linked_face(vertexs: &[Rc<RefCell<Vertex>>], face: UnlinkedFace) -> Option<RefCell<Face>> { | |
let a = match vertexs.get(face.a) { | |
Some(x) => x.clone(), | |
None => return None, | |
}; | |
let b = match vertexs.get(face.b) { | |
Some(x) => x.clone(), | |
None => return None, | |
}; | |
let c = match vertexs.get(face.c) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn linked_face(vertexs: &[Rc<RefCell<Vertex>>], face: UnlinkedFace) -> Option<RefCell<Face>> { | |
let a = match vertexs.slice(face.a, face.a + 1).iter().next() { | |
Some(x) => x.clone(), | |
None => return None, | |
}; | |
let b = match vertexs.slice(face.b, face.b + 1).iter().next() { | |
Some(x) => x.clone(), | |
None => return None, | |
}; | |
let c = match vertexs.slice(face.c, face.c + 1).iter().next() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn linked_face(vertexs: &[Rc<RefCell<Vertex>>], face: UnlinkedFace) -> Option<RefCell<Face>> { | |
let a = match vertexs.slice(face.a, face.a + 1).iter().next() { | |
Some(x) => x.clone(), | |
None => return None, | |
}; | |
let b = match vertexs.slice(face.b, face.b + 1).iter().next() { | |
Some(x) => x.clone(), | |
None => return None, | |
}; | |
let c = match vertexs.slice(face.c, face.c + 1).iter().next() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn linked_face(vertexs: &[Rc<RefCell<Vertex>>], face: UnlinkedFace) -> Option<RefCell<Face>> { | |
Some( | |
RefCell::new( | |
Face { | |
a:match vertexs.slice(face.a,face.a+1).iter().next() { | |
Some(x) => x.clone(), | |
None => return None, | |
}, | |
b:match vertexs.slice(face.b,face.b+1).iter().next() { | |
Some(x) => x.clone(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn linked_face(vertexs: &[Rc<RefCell<Vertex>>], face: UnlinkedFace) -> Option<RefCell<Face>> { | |
Some( | |
RefCell::new( | |
Face { | |
a:match vertexs.slice(face.a,face.a+1).iter().next() { | |
Some(x) => x.clone(), | |
None => return None, | |
}, | |
b:match vertexs.slice(face.b,face.b+1).iter().next() { | |
Some(x) => x.clone(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let a = vertexs.slice(face.a,face.a+1).iter().next(); | |
let mut aa: Rc<RefCell<Vertex>>; | |
match a { | |
Some(x) => aa = x.clone(), | |
None => (), | |
}; | |
error: use of possibly uninitialized variable: `aa` |