about summary refs log tree commit diff
path: root/src/facility/envsys.rs
blob: 34068ccfc3cad1e1aa421de1fd01dd5a437c740b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use crate::error::Result;
use crate::facility::{ CreatableFacility, Facility, FacilityType };

use std::any::Any;

use async_fs::File;


pub struct EnvSys {
  sysmon: File,
}

impl Facility for EnvSys {
  fn as_any_mut(&mut self) -> &mut dyn Any {
    self
  }
}

impl CreatableFacility for EnvSys {
  const FACILITY_TYPE: FacilityType = FacilityType::ENVSYS;

  async fn new() -> Result<Self> {
    println!("loading envsys");
    let sysmon = File::open("/dev/sysmon").await?;

    Ok(EnvSys {
      sysmon
    })
  }

}