Update code to 2018 edition

This commit is contained in:
Pyfisch
2021-03-29 20:49:33 +02:00
parent 3e53ffaf24
commit 2916e56d76
3 changed files with 7 additions and 15 deletions
+2 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "httpdate"
version = "0.3.2"
version = "1.0.0-alpha"
authors = ["Pyfisch <pyfisch@gmail.com>"]
license = "MIT/Apache-2.0"
description = "HTTP date parsing and formatting"
@@ -8,6 +8,7 @@ keywords = ["http", "date", "time", "simple", "timestamp"]
readme = "README.md"
documentation = "https://pyfisch.github.io/httpdate/httpdate/index.html"
repository = "https://github.com/pyfisch/httpdate"
edition = "2018"
[features]
unstable = []
+1 -3
View File
@@ -1,11 +1,9 @@
#[allow(unused_imports)]
use std::ascii::AsciiExt;
use std::fmt::{self, Display, Formatter};
use std::cmp;
use std::str::{FromStr, from_utf8_unchecked};
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use Error;
use crate::Error;
/// HTTP timestamp type.
///
+4 -11
View File
@@ -23,26 +23,19 @@ use std::io;
use std::num::ParseIntError;
use std::time::SystemTime;
pub use httpdate::HttpDate;
pub use date::HttpDate;
mod httpdate;
mod date;
/// An opaque error type for all parsing errors.
#[derive(Debug)]
pub struct Error(());
impl error::Error for Error {
fn description(&self) -> &str {
"string contains no or an invalid date"
}
fn cause(&self) -> Option<&error::Error> {
None
}
}
impl error::Error for Error {}
impl Display for Error {
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
f.write_str(error::Error::description(self))
f.write_str("string contains no or an invalid date")
}
}