capitol 0.6.1

Parse United States Congress legislative document citations
Documentation
use std::fmt::Display;

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Congress(pub usize);

impl Display for Congress {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}

#[derive(Clone, Debug, PartialEq)]
pub enum Chamber {
    House,
    Senate,
    Joint,
}

impl Display for Chamber {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(
            f,
            "{}",
            match self {
                Self::House => 'h',
                Self::Senate => 's',
                Self::Joint => 'j',
            }
        )
    }
}

#[derive(Clone, Debug, PartialEq)]
pub enum MeasureType {
    Bill,
    Resolution,
    ConcurrentResolution,
    JointResolution,
}

impl Display for MeasureType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(
            f,
            "{}",
            match self {
                Self::Bill => "",
                Self::Resolution => "res",
                Self::ConcurrentResolution => "conres",
                Self::JointResolution => "jres",
            }
        )
    }
}

#[derive(Clone, Debug, PartialEq)]
pub enum CommitteeDocumentType {
    Print,
    Report,
}

impl Display for CommitteeDocumentType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(
            f,
            "{}",
            match self {
                Self::Print => "prt",
                Self::Report => "rpt",
            }
        )
    }
}