mod body;
mod client;
mod request;
mod response;
mod server;
mod status;
pub use body::Body;
pub use client::{Client, DefaultClient, Do, Get, Head, NewRequest, NewRequestWithContext, Post, PostForm};
pub use request::{Header, IntoReqBody, ParseHTTPVersion, Request};
pub use response::{Response, ResponseWriter};
pub use server::{HandleFunc, Handler, HandlerFunc, IntoMux, ListenAndServe, Server, ServeMux};
pub use status::*;
pub const MethodGet: &str = "GET";
pub const MethodPost: &str = "POST";
pub const MethodPut: &str = "PUT";
pub const MethodDelete: &str = "DELETE";
pub const MethodHead: &str = "HEAD";
pub const MethodPatch: &str = "PATCH";
pub const MethodOptions: &str = "OPTIONS";
pub(crate) fn rt() -> &'static tokio::runtime::Runtime {
crate::goroutine::runtime()
}
pub(crate) fn block_on<F, T>(fut: F) -> T
where
F: std::future::Future<Output = T>,
{
match tokio::runtime::Handle::try_current() {
Ok(h) => tokio::task::block_in_place(|| h.block_on(fut)),
Err(_) => rt().block_on(fut),
}
}