prest 0.5.1

Progressive RESTful framework
Documentation
/// Macro that simplifies lazy globals by reducing boilerplate, allowing `?` operator and async init
#[macro_export]
macro_rules! state {
    ($(($v:tt))? $struct_name:ident: $type:ty = $init:block) => {
        pub$(($v))? static $struct_name: prest::Lazy<$type> = prest::Lazy::new(|| {
            fn init() -> prest::Somehow<$type> {
                let v = { $init };
                Ok(v)
            }
            init().expect("Prest initialization must finish successfully")
        });
    };

    ($(($v:tt))? $struct_name:ident: $type:ty = async $init:block) => {
        pub$(($v))? static $struct_name: prest::Lazy<$type> = prest::Lazy::new(|| {
            async fn init() -> prest::Somehow<$type> {
                let v = { $init };
                Ok(v)
            }
            if let Ok(handle) = prest::_host::RuntimeHandle::try_current() {
                if handle.runtime_flavor() != prest::_host::RuntimeFlavor::CurrentThread {
                    prest::block_in_place(move || handle.block_on(init())
                        .expect("Prest initialization must finish successfully"))
                } else {
                    panic!("Prest doesn't support async state inside of the tokio's current_thread runtime")
                }
            } else {
                prest::_host::RuntimeBuilder::new_current_thread()
                    .enable_all()
                    .build()
                    .expect("Runtime spawn should be fine outside of another runtime")
                    .block_on(init())
                    .expect("Prest initialization must finish successfully")
            }
        });
    };
}