orthodoxy 0.2.0

A collection of my utility libraries
Documentation
use std::{collections::HashMap, error::Error, thread};

use facet::Facet;
use futures::Stream;
use sd_notify::NotifyState;
use tracing::warn;

pub trait Service
where
    Self: Facet<'static>,
{
    type Err: Error + From<std::io::Error> + Send;
    type Mesg;

    fn setup(&mut self) -> Result<bool, Self::Err>;

    //fn one_run(&self);
    //fn one_run(&mut self) -> Result<(), Self::Err>;

    fn daemon<S: Stream>(&mut self, stream: S) -> Result<(), Self::Err> {
        let initialized = self.setup()?;
        if initialized {
            sd_notify::notify(&[NotifyState::Ready])?;
            let watchdoggy = if let Some(w) = sd_notify::watchdog_enabled() {
            } else {
            };

            let mut looping = true;
            while looping {

                //looping = f(self)?;
            }
        } else {
            warn!("Failed to setup daemon");
            return Err(std::io::Error::from_raw_os_error(123).into());
        }
        Ok(())
    }
}

pub struct TestServer {
    messages: HashMap<String, Vec<String>>,
}

pub trait Client<S: Service> {}

pub trait Settings {}

pub struct Mesg<T> {
    data: T,
}

pub enum ControlMesg {
    Reload,
    Restart,
    Quit,
}

pub struct Request<T> {
    data: T,
}

pub struct Reply<T> {
    data: T,
}