You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: date.rs
    path of file: ./repos/summer-boot/summer-boot/src/http1
    
    the code of the file until where you have to start completion: use std::fmt::{self, Display, Formatter};
use std::str::{from_utf8, FromStr};
use std::time::{Duration, SystemTime, UNIX_EPOCH};

use http_types::{bail, ensure, format_err};

const IMF_FIXDATE_LENGTH: usize = 29;
const RFC850_MAX_LENGTH: usize = 23;
const ASCTIME_LENGTH: usize = 24;

const YEAR_9999_SECONDS: u64 = 253402300800;
const SECONDS_IN_DAY: u64 = 86400;
const SECONDS_IN_HOUR: u64 = 3600;

/// 使用`Display` trait 设置格式
/// 将时间戳转换为或从 `SytemTime` 换为要使用的时间戳
/// 支持比较和排序
#[derive(Copy, Clone, Debug, Eq)]
pub struct HttpDate {
    /// 0...59
    second: u8,
    /// 0...59
    minute: u8,
    /// 0...23
    hour: u8,
    /// 1...31
    day: u8,
    /// 1...12
    month: u8,
    /// 1970...9999
    year: u16,
    /// 1...7
    week_day: u8,
}

/// 从HTTP header 字段解析日期。
///
/// 支持首选的IMF固定日期和传统RFC 805和ascdate格式。两位数年份映射到
/// 1970 和 2069.
#[allow(dead_code)]
pub(crate) fn parse_http_date(s: &str) -> http_types::Result<SystemTime> {
    s
    
fn parse_asctime(s: &[u8]) -> http_types::Result<HttpDate> {
    // 例如: `Sun Nov  6 08:49:37 1994`
    if s.len() != ASCTIME_LENGTH || s[10] != b' ' || s[13] != b':' || s[16] != b':' || s[19] != b' '
    {
        bail!("Date time not in asctime format");
    }
    Ok(HttpDate {
        second: from_utf8(&s[17..19])?.parse()?,
        minute: from_utf8(&s[14..16])?.parse()?,
        hour: from_utf8(&s[11..13])?.parse()?,
        day: {
            let x = &s[8..10];
            from_utf8(if x[0] == b' ' { &x[1..2] } else { x })?.parse()?
        },
        month: match &s[4..8] {
            b"Jan " => 1,
            b"Feb " => 2,
            b"Mar " => 3,
            b"Apr " => 4,
            b"May " => 5,
            b"Jun " => 6,
            b"Jul " => 7,
            b"Aug " => 8,
            b"Sep " => 9,
            b"Oct " => 10,
            b"Nov " => 11,
            b"Dec " => 12,
            _ => bail!("Invalid month"),
        },
        year: from_utf8(&s[20..24])?.parse()?,
        week_day: match &s[0..4] {
            b"Mon " => 1,
            b"Tue " => 2,
            b"Wed " => 3,
            b"Thu " => 4,
            b"Fri " => 5,
            b"Sat " => 6,
            b"Sun " => 7,
            _ => bail!("Invalid day"),
        },
    })
}