use std::{ fmt, num::ParseIntError, str::{self, FromStr}, }; use thiserror::Error; /// The data for indicating authorship of an action within a /// [`super::Commit`]. #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub struct Author { /// Name corresponding to `user.name` in the git config. /// /// Note: this must not contain `<` or `>`. pub name: String, /// Email corresponding to `user.email` in the git config. /// /// Note: this must not contain `<` or `>`. pub email: String, /// The time of this author's action. pub time: Time, } /// The time of a [`Author`]'s action. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub struct Time { seconds: i64, offset: i32, } impl Time { pub fn new(seconds: i64, offset: i32) -> Self { Self { seconds, offset } } /// Return the time, in seconds, since the epoch. pub fn seconds(&self) -> i64 { self.seconds } /// Return the timezone offset, in minutes. pub fn offset(&self) -> i32 { self.offset } } impl From