Skip to content

Instantly share code, notes, and snippets.

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()]
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);
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
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
},
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) {
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() {
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() {
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(),
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(),
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`