complete threads till 06
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
use std::sync::mpsc::{Receiver, Sender};
|
||||
|
||||
use data::TicketDraft;
|
||||
use store::TicketStore;
|
||||
|
||||
pub mod data;
|
||||
pub mod store;
|
||||
|
||||
pub enum Command {
|
||||
Insert(todo!()),
|
||||
Insert(TicketDraft),
|
||||
}
|
||||
|
||||
// Start the system by spawning the server thread.
|
||||
@@ -20,4 +23,14 @@ pub fn launch() -> Sender<Command> {
|
||||
// Enter a loop: wait for a command to show up in
|
||||
// the channel, then execute it, then start waiting
|
||||
// for the next command.
|
||||
pub fn server(receiver: Receiver<Command>) {}
|
||||
pub fn server(receiver: Receiver<Command>) {
|
||||
let mut tickStor = TicketStore::new();
|
||||
'aLoop: loop {
|
||||
let command = receiver.recv().ok().unwrap();
|
||||
match command {
|
||||
Command::Insert(a) => {
|
||||
tickStor.add_ticket(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user