added core docs
This commit is contained in:
parent
da30491cb9
commit
64899939b4
@ -1,4 +1,12 @@
|
||||
//! This module contains the core components of the Flight Software Rust Crate (FSRC) collection
|
||||
//! This includes components to perform the following tasks
|
||||
//!
|
||||
//! 1. [Object Management][objects]
|
||||
//! 2. [Task Scheduling][executable]
|
||||
//! 3. [Events][event] and [event management][event_man]
|
||||
//! 4. [Pre-Allocated memory pools][pool]
|
||||
pub mod event_man;
|
||||
pub mod events;
|
||||
pub mod executable;
|
||||
pub mod objects;
|
||||
pub mod pool;
|
||||
|
@ -71,7 +71,7 @@ impl<E> EventManager<E> {
|
||||
// To prevent double insertions
|
||||
for entry in vec.iter() {
|
||||
if entry.ltype == key && entry.dest.id() == dest.id() {
|
||||
return
|
||||
return;
|
||||
}
|
||||
}
|
||||
vec.push(Listener {
|
||||
|
0
src/core/pool.rs
Normal file
0
src/core/pool.rs
Normal file
34
src/main.rs
34
src/main.rs
@ -1,35 +1,3 @@
|
||||
use launchpad::core::events::{Event, Severity};
|
||||
use std::sync::mpsc::channel;
|
||||
use std::thread;
|
||||
|
||||
fn main() {
|
||||
basic_event_test();
|
||||
}
|
||||
|
||||
fn basic_event_test() {
|
||||
let test_event_0 = Event::new(Severity::INFO, 0, 0);
|
||||
let (event_sender, event_receiver) = channel();
|
||||
let t0_sender = event_sender.clone();
|
||||
let t0 = thread::spawn(move || {
|
||||
t0_sender
|
||||
.send(test_event_0.unwrap())
|
||||
.expect("Sending event from t0 failed");
|
||||
});
|
||||
|
||||
let test_event_1 = Event::new(Severity::MEDIUM, 1, 8);
|
||||
let t1 = thread::spawn(move || {
|
||||
event_sender
|
||||
.send(test_event_1.unwrap())
|
||||
.expect("Sending event from t1 failed");
|
||||
});
|
||||
|
||||
let mut event_cntr = 0;
|
||||
while event_cntr < 2 {
|
||||
if let Ok(event) = event_receiver.recv() {
|
||||
println!("Received event {:?}", event);
|
||||
event_cntr += 1;
|
||||
}
|
||||
}
|
||||
t0.join().unwrap();
|
||||
t1.join().unwrap();
|
||||
println!("Hello World")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user