Skip to main content

ephemeris_forge_github/operation/
autolinks.rs

1use std::fmt;
2
3use crate::Autolink;
4
5/// One write to the repository's autolink references.
6#[derive(Clone, Debug, Eq, PartialEq)]
7pub enum Operation {
8    /// Create the autolink.
9    Create {
10        /// The key prefix.
11        key_prefix: String,
12        /// The autolink to create.
13        autolink: Autolink,
14    },
15    /// Delete the autolink.
16    Delete {
17        /// The key prefix.
18        key_prefix: String,
19        /// The id GitHub gave the autolink.
20        id: u64,
21    },
22}
23
24impl fmt::Display for Operation {
25    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26        match self {
27            Self::Create {
28                key_prefix,
29                autolink: _,
30            }
31            | Self::Delete { key_prefix, id: _ } => write!(f, "autolink {key_prefix}"),
32        }
33    }
34}