mirror of
https://github.com/openharmony/third_party_rust_httpdate.git
synced 2026-07-01 03:15:42 -04:00
Update code to 2018 edition
This commit is contained in:
+2
-1
@@ -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,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
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user