Add a couple doccomments
This commit is contained in:
parent
29f436f938
commit
f44b1baf6d
|
@ -8,6 +8,10 @@ use tiny_http::Response;
|
|||
use tiny_http::Server;
|
||||
use tiny_http::StatusCode;
|
||||
|
||||
/// Start the server on port 3243
|
||||
///
|
||||
/// Runs the server in a single thread, bound to port 3243. Requests are handled
|
||||
/// first-come, first-serve
|
||||
pub fn go(domains: &[&str]) {
|
||||
let server = Server::http("0.0.0.0:3243").unwrap();
|
||||
|
||||
|
@ -31,6 +35,8 @@ pub enum Route<'a> {
|
|||
}
|
||||
|
||||
impl<'a> Route<'a> {
|
||||
|
||||
/// Given a request, parse out the appropriate Route for that request
|
||||
pub fn parse_request(r: &'a Request) -> Self {
|
||||
let segments: Vec<_> = r.url()
|
||||
.split('/')
|
||||
|
@ -51,6 +57,7 @@ impl<'a> Route<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Generate a Response for this route
|
||||
pub fn render<'b>(&self, domains: &[&'b str]) -> Response<Cursor<Cow<'b, [u8]>>> {
|
||||
match self {
|
||||
Self::Next(this_domain) | Self::Prev(this_domain) => {
|
||||
|
|
Loading…
Reference in a new issue