fixing stuff again

This commit is contained in:
Enrico Fasoli 2015-10-02 18:35:13 +02:00
parent 4e08b384c8
commit 0004fa2acf
4 changed files with 16 additions and 8 deletions

View File

@ -1,7 +1,4 @@
pub struct Point { use util::Point;
pub x: i32,
pub y: i32
}
pub struct Action { pub struct Action {
pub source: Point, pub source: Point,

View File

@ -1,12 +1,16 @@
use action::Action; use action::Action;
use std::vec; use std::vec;
fn make_connections() -> Vec<f64> {
vec![0 as f64;9]
}
trait Block { trait Block {
fn get_connections(&self) -> &Vec<f64>; fn get_connections(&self) -> &Vec<f64>;
fn get_value(&self) -> &f64; fn get_value(&self) -> &f64;
fn get_name(&self) -> &'static str; fn get_name(&self) -> &'static str;
fn compute(&self) -> Vec<Action>; fn compute(&mut self) -> Vec<Action>;
fn clean(&self); fn clean(&mut self);
} }
struct NeuronBlock { struct NeuronBlock {
@ -25,8 +29,10 @@ impl Block for NeuronBlock {
fn get_name(&self) -> &'static str { fn get_name(&self) -> &'static str {
"Neuron" "Neuron"
} }
fn compute(&self) -> Vec<Action> { fn compute(&mut self) -> Vec<Action> {
Vec::new() Vec::new()
} }
fn clean(&self) { } fn clean(&mut self) {
self.current_value = self.new_value
}
} }

View File

@ -1,3 +1,4 @@
mod util;
mod action; mod action;
mod block; mod block;

4
src/util.rs Normal file
View File

@ -0,0 +1,4 @@
pub struct Point {
pub x: i32,
pub y: i32
}