cute message

master
Avril 4 years ago
parent c3cd739dff
commit 32c4bb85a1
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -1,7 +1,7 @@
[package]
name = "lolicron"
version = "0.1.0"
authors = ["Avril <flanchan@cumallover.me>"]
authors = ["Avril <flanchan@cumallover.me>", "Mx. Package Install <boku@plum.moe>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

@ -192,6 +192,44 @@ impl Logger
};
}
#[macro_export] macro_rules! status {
($obj:expr) => {
{
struct Status;
use std::{
borrow::Borrow,
fmt,
};
impl Borrow<$crate::log::Level> for Status {
fn borrow(&self) -> &$crate::log::Level
{
&$crate::log::Level::Debug
}
}
impl fmt::Display for Status
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
{
use recolored::Colorize;
write!(f, "{}", "Status".blue())
}
}
impl $crate::log::AsLevel for Status{}
let stdout = std::io::stdout();
let stdout = stdout.lock();
$crate::log::Logger::global().println(stdout, Status, $obj).expect("i/o error");
}
};
($fmt:literal, $($args:expr),*) => {
status!(format!($fmt, $($args,)*));
};
}
#[macro_export] macro_rules! info {
($obj:expr) => {
{

@ -15,6 +15,7 @@ use tokio::{
},
task,
};
use lazy_static::lazy_static;
mod util;
use util::*;
@ -60,13 +61,34 @@ async fn do_thing_every() -> Result<(mpsc::Sender<()>, task::JoinHandle<()>), Bo
Ok((tx, handle))
}
fn print_stats()
{
lazy_static! {
static ref AUTHORS: String = env!("CARGO_PKG_AUTHORS").replace( ":", ", ");
};
status!("This is the lolicron daemon version {} by {}", env!("CARGO_PKG_VERSION"), &AUTHORS[..]);
status!("---");
status!("Compiled with:");
#[cfg(nightly)] status!(" +nightly");
#[cfg(debug_assertions)] status!(" +debug_assertions");
status!("features:");
#[cfg(feature="threaded")] status!(" +threaded");
status!("");
status!("GPl'd with <3");
status!("Please enjoy");
status!("---");
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
log::init(log::Level::Debug);
debug!("Initialised");
debug!("Logger initialised");
print_stats();
let oneesan = live::watch(".");
{
@ -81,8 +103,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
oneesan.shutdown().await.expect("oneesan panic");
println!("{:?}", config::parse_global_single("example.rori").await.expect("Waaaaaah"));
dangerous!("Wheeeee");
//let (mut tx, h) = do_thing_every().await?;
// loop {

@ -98,7 +98,7 @@ where F:FnOnce(T)
if #[cfg(nightly)] {
self.0.get_ref()
} else {
std::mem::transmute::<_,&'a T>(self.0.as_ptr())
std::mem::transmute(self.0.as_ptr())
}
}
}
@ -113,7 +113,7 @@ where F:FnOnce(T)
if #[cfg(nightly)] {
self.0.get_mut()
} else {
std::mem::transmute::<_,&'a T>(self.0.as_mut_ptr())
std::mem::transmute(self.0.as_mut_ptr())
}
}
}

Loading…
Cancel
Save