force docs, other warnings

pull/1/head
chris west 4 years ago
parent 1a102fa9a8
commit a1eb708980

@ -1,7 +1,15 @@
//! Cheesy way to easily wrap text in console colors.
//! Example:
//! ```
//! use phd::color;
//! println!("{}Error: {}{}", color::Red, "Something broke.", color::Reset);
//! ```
use std::fmt;
macro_rules! color {
($t:ident, $code:expr) => {
#[allow(missing_docs)]
pub struct $t;
impl fmt::Display for $t {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {

@ -1,7 +1,20 @@
//! phd is a small, easy-to-use Gopher server that tries to make
//! serving up a Gopher site quick and painless. Best used for local
//! development or low traffic Gopher sites.
#![allow(unused_must_use)]
#![warn(absolute_paths_not_starting_with_crate)]
#![warn(explicit_outlives_requirements)]
#![warn(unreachable_pub)]
#![warn(deprecated_in_future)]
#![warn(missing_docs)]
#![allow(clippy::while_let_on_iterator)]
pub mod color;
pub mod request;
pub mod server;
pub use crate::request::Request;
/// Alias for a generic Result type.
pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;

@ -1,13 +1,23 @@
//! A Request represents a Gopher request made by a client. phd can
//! serve directory listings as Gopher Menus, plain text files as
//! Text, binary files as downloads, Gophermap files as menus, or
//! executable files as dynamic content.
use crate::Result;
use std::fs;
/// This struct represents a single gopher request.
#[derive(Debug, Clone)]
pub struct Request {
/// Gopher selector requested
pub selector: String,
/// Search query string, if any.
pub query: String,
/// Root directory of the server. Can't serve outside of this.
pub root: String,
/// Host of the currently running server.
pub host: String,
/// Port of the currently running server.
pub port: u16,
}

@ -1,3 +1,5 @@
//! A simple multi-threaded Gopher server.
use crate::{color, Request, Result};
use gophermap::{GopherMenu, ItemType};
use std::{

Loading…
Cancel
Save