Skip to content

Instantly share code, notes, and snippets.

struct Vertex {
x: f64,
y: f64,
z: f64,
}
struct Face {
a: &Vertex,
b: &Vertex,
c: &Vertex,
use std::rc::Rc;
struct Vertex {
x: f64,
y: f64,
z: f64,
}
struct Face {
a: Rc<Vertex>,
use std::io::File;
use std::io::BufferedReader;
use std::rc::Rc;
use std::cell::RefCell;
use std::cell::Cell;
struct Vertex {
x: f64,
y: f64,
z: f64,
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`
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(),
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>> {
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(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
},