oxedyne/fe2o3/fe2o3_bot/src/handles.rs
600 bytes, 3 runs
created by r1870400018:40, which is this file's identity for as long as the history lasts, whatever it is later renamed to
download · who wrote it · its history
| 1 | use oxedyne_fe2o3_core::thread::Sentinel; |
| 2 | |
| 3 | #[derive(Debug, Default)] |
| 4 | pub struct Handle<T> { |
| 5 | id: String, |
| 6 | pub thread: Option<std::thread::JoinHandle<T>>, |
| 7 | sentinel: Sentinel, |
| 8 | } |
| 9 | |
| 10 | impl<T> Handle<T> { |
| 11 | |
| 12 | pub fn new( |
| 13 | id: String, |
| 14 | hand: std::thread::JoinHandle<T>, |
| 15 | sentinel: Sentinel, |
| 16 | ) -> Self { |
| 17 | Self { |
| 18 | id: id, |
| 19 | thread: Some(hand), |
| 20 | sentinel: sentinel, |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | pub fn id(&self) -> &String { &self.id } |
| 25 | pub fn sentinel(&self) -> &Sentinel { &self.sentinel } |
| 26 | } |