rustfmt
This commit is contained in:
parent
6bc88ef6b0
commit
50cf832c3f
12
src/main.rs
12
src/main.rs
|
@ -1,11 +1,11 @@
|
||||||
mod adaptors;
|
mod adaptors;
|
||||||
mod drivers;
|
mod drivers;
|
||||||
use crate::adaptors::{Adaptor,FakeAdaptor};
|
use crate::adaptors::{Adaptor, FakeAdaptor};
|
||||||
use crate::drivers::{Driver, FakeDriver};
|
use crate::drivers::{Driver, FakeDriver};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Channel (Option<u8>);
|
pub struct Channel(Option<u8>);
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct TallyState {
|
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,
|
adaptor: T,
|
||||||
driver: U,
|
driver: U,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Adaptor,U:Driver> Server<T,U> {
|
impl<T: Adaptor, U: Driver> Server<T, U> {
|
||||||
fn run(&mut self) {
|
fn run(&mut self) {
|
||||||
let rx = self.adaptor.run();
|
let rx = self.adaptor.run();
|
||||||
let tx = self.driver.run();
|
let tx = self.driver.run();
|
||||||
loop{
|
loop {
|
||||||
tx.send(rx.recv().unwrap()).unwrap();
|
tx.send(rx.recv().unwrap()).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut s = Server{
|
let mut s = Server {
|
||||||
adaptor: FakeAdaptor::new(8),
|
adaptor: FakeAdaptor::new(8),
|
||||||
driver: FakeDriver::new(),
|
driver: FakeDriver::new(),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue