seperated crate into lib and binary
This commit is contained in:
parent
f26ca7948b
commit
81a49e8290
|
@ -4,6 +4,10 @@ version = "0.2.0"
|
||||||
authors = ["noonebtw <noonebtw@gmail.com>"]
|
authors = ["noonebtw <noonebtw@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "nowm"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
24
src/lib.rs
Normal file
24
src/lib.rs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
pub mod backends;
|
||||||
|
pub mod clients;
|
||||||
|
pub mod state;
|
||||||
|
pub mod util;
|
||||||
|
|
||||||
|
pub mod error {
|
||||||
|
use thiserror::Error;
|
||||||
|
|
||||||
|
#[derive(Debug, Error)]
|
||||||
|
pub enum Error {
|
||||||
|
#[error("placeholder error for Result<T> as Option<T>")]
|
||||||
|
NonError,
|
||||||
|
#[error("Unknown Event")]
|
||||||
|
UnknownEvent,
|
||||||
|
#[error("Unhandled VirtualKeyCode")]
|
||||||
|
UnhandledVirtualKeyCode,
|
||||||
|
#[error(transparent)]
|
||||||
|
IoError(#[from] std::io::Error),
|
||||||
|
#[error(transparent)]
|
||||||
|
FmtError(#[from] std::fmt::Error),
|
||||||
|
#[error(transparent)]
|
||||||
|
XlibError(#[from] crate::backends::xlib::XlibError),
|
||||||
|
}
|
||||||
|
}
|
29
src/main.rs
29
src/main.rs
|
@ -7,32 +7,8 @@ use log4rs::{
|
||||||
encode::pattern::PatternEncoder,
|
encode::pattern::PatternEncoder,
|
||||||
Config,
|
Config,
|
||||||
};
|
};
|
||||||
use state::WMConfig;
|
|
||||||
|
|
||||||
mod backends;
|
use wm::state::WMConfig;
|
||||||
mod clients;
|
|
||||||
mod state;
|
|
||||||
mod util;
|
|
||||||
|
|
||||||
pub mod error {
|
|
||||||
use thiserror::Error;
|
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
|
||||||
pub enum Error {
|
|
||||||
#[error("placeholder error for Result<T> as Option<T>")]
|
|
||||||
NonError,
|
|
||||||
#[error("Unknown Event")]
|
|
||||||
UnknownEvent,
|
|
||||||
#[error("Unhandled VirtualKeyCode")]
|
|
||||||
UnhandledVirtualKeyCode,
|
|
||||||
#[error(transparent)]
|
|
||||||
IoError(#[from] std::io::Error),
|
|
||||||
#[error(transparent)]
|
|
||||||
FmtError(#[from] std::fmt::Error),
|
|
||||||
#[error(transparent)]
|
|
||||||
XlibError(#[from] crate::backends::xlib::XlibError),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn init_logger() {
|
fn init_logger() {
|
||||||
let encoder = Box::new(PatternEncoder::new(
|
let encoder = Box::new(PatternEncoder::new(
|
||||||
|
@ -83,7 +59,7 @@ fn main() {
|
||||||
WMConfig::default()
|
WMConfig::default()
|
||||||
});
|
});
|
||||||
|
|
||||||
state::WindowManager::<backends::xlib::XLib>::new(config).run();
|
wm::state::WindowManager::<wm::backends::xlib::XLib>::new(config).run();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn log_prologue() {
|
fn log_prologue() {
|
||||||
|
@ -102,7 +78,6 @@ fn log_prologue() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_logger() {
|
fn test_logger() {
|
||||||
init_logger();
|
init_logger();
|
||||||
// asdf
|
|
||||||
|
|
||||||
log_prologue();
|
log_prologue();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue