git_actor/
lib.rs

1//! This crate provides ways of identifying an actor within the git repository both in shared/mutable and mutable variants.
2//!
3//! ## Feature Flags
4#![cfg_attr(
5    feature = "document-features",
6    cfg_attr(doc, doc = ::document_features::document_features!())
7)]
8#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
9#![deny(missing_docs, rust_2018_idioms)]
10#![forbid(unsafe_code)]
11
12use bstr::{BStr, BString};
13pub use git_date::{time::Sign, Time};
14
15///
16pub mod signature;
17
18/// A mutable signature is created by an actor at a certain time.
19///
20/// Note that this is not a cryptographical signature.
21#[derive(Default, PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
22#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
23pub struct Signature {
24    /// The actors name.
25    pub name: BString,
26    /// The actor's email.
27    pub email: BString,
28    /// The time stamp at which the signature is performed.
29    pub time: Time,
30}
31
32/// A immutable signature is created by an actor at a certain time.
33///
34/// Note that this is not a cryptographical signature.
35#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy, Default)]
36#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
37pub struct SignatureRef<'a> {
38    /// The actor's name.
39    #[cfg_attr(feature = "serde1", serde(borrow))]
40    pub name: &'a BStr,
41    /// The actor's email.
42    pub email: &'a BStr,
43    /// The time stamp at which the signature was performed.
44    pub time: git_date::Time,
45}