This commit is contained in:
Sam W 2019-02-16 12:24:24 +00:00
parent 6bc88ef6b0
commit 50cf832c3f
1 changed files with 6 additions and 6 deletions

View File

@ -1,11 +1,11 @@
mod adaptors;
mod drivers;
use crate::adaptors::{Adaptor,FakeAdaptor};
use crate::adaptors::{Adaptor, FakeAdaptor};
use crate::drivers::{Driver, FakeDriver};
use std::fmt;
#[derive(Clone)]
pub struct Channel (Option<u8>);
pub struct Channel(Option<u8>);
#[derive(Clone)]
pub struct TallyState {
@ -28,23 +28,23 @@ impl fmt::Display for TallyState {
}
}
struct Server<T:Adaptor,U:Driver> {
struct Server<T: Adaptor, U: Driver> {
adaptor: T,
driver: U,
}
impl<T:Adaptor,U:Driver> Server<T,U> {
impl<T: Adaptor, U: Driver> Server<T, U> {
fn run(&mut self) {
let rx = self.adaptor.run();
let tx = self.driver.run();
loop{
loop {
tx.send(rx.recv().unwrap()).unwrap();
}
}
}
fn main() {
let mut s = Server{
let mut s = Server {
adaptor: FakeAdaptor::new(8),
driver: FakeDriver::new(),
};