hooks::types: Implement PartialEq on hooks

Signed-off-by: pep <pep@bouah.net>
This commit is contained in:
pep 2026-01-08 13:43:33 +01:00
commit 1ad82dfeac
2 changed files with 16 additions and 14 deletions

View file

@ -6,6 +6,8 @@ Version NEXT:
bot. bot.
- Add 'admins' config, trusted accounts for admin tasks - Add 'admins' config, trusted accounts for admin tasks
- Add 'rejoin' command to rejoin (leave/join) all rooms - Add 'rejoin' command to rejoin (leave/join) all rooms
* Added:
- Add PartialEq on hook types.
Version 0.2.0: Version 0.2.0:
2023-08-23 Maxime “pep” Buquet <pep@bouah.net> 2023-08-23 Maxime “pep” Buquet <pep@bouah.net>

View file

@ -14,13 +14,13 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
/// Defines a generic user that can be used for many purposes. /// Defines a generic user that can be used for many purposes.
#[derive(Debug, Clone)] #[derive(Debug, Clone, PartialEq)]
pub struct User { pub struct User {
/// Name of the user /// Name of the user
pub name: String, pub name: String,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone, PartialEq)]
pub struct Commit { pub struct Commit {
/// Reference of the commit /// Reference of the commit
pub ref_: String, pub ref_: String,
@ -30,13 +30,13 @@ pub struct Commit {
pub url: String, pub url: String,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone, PartialEq)]
pub struct Repository { pub struct Repository {
/// Name of the project. /// Name of the project.
pub name: String, pub name: String,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone, PartialEq)]
pub struct Push { pub struct Push {
/// Reference where commits have been pushed to. /// Reference where commits have been pushed to.
pub ref_: String, pub ref_: String,
@ -50,7 +50,7 @@ pub struct Push {
pub pusher: User, pub pusher: User,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone, PartialEq)]
pub enum IssueAction { pub enum IssueAction {
Update, Update,
Open, Open,
@ -58,7 +58,7 @@ pub enum IssueAction {
Reopen, Reopen,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone, PartialEq)]
pub struct Issue { pub struct Issue {
pub action: Option<IssueAction>, pub action: Option<IssueAction>,
pub repository: Repository, pub repository: Repository,
@ -68,13 +68,13 @@ pub struct Issue {
pub url: Option<String>, pub url: Option<String>,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone, PartialEq)]
pub struct IssueAttrs { pub struct IssueAttrs {
pub id: u64, pub id: u64,
pub title: String, pub title: String,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone, PartialEq)]
pub enum MergeRequestAction { pub enum MergeRequestAction {
Update, Update,
Open, Open,
@ -87,7 +87,7 @@ pub enum MergeRequestAction {
Unapproval, Unapproval,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone, PartialEq)]
pub struct MergeRequest { pub struct MergeRequest {
pub action: Option<MergeRequestAction>, pub action: Option<MergeRequestAction>,
pub repository: Repository, pub repository: Repository,
@ -97,13 +97,13 @@ pub struct MergeRequest {
pub url: Option<String>, pub url: Option<String>,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone, PartialEq)]
pub struct MergeRequestAttrs { pub struct MergeRequestAttrs {
pub id: u64, pub id: u64,
pub title: String, pub title: String,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone, PartialEq)]
pub struct Note { pub struct Note {
pub snippet: bool, pub snippet: bool,
pub commit: Option<Commit>, pub commit: Option<Commit>,
@ -114,13 +114,13 @@ pub struct Note {
pub url: String, pub url: String,
} }
#[derive(Debug)] #[derive(Debug, Clone, PartialEq)]
pub enum WikiAction { pub enum WikiAction {
Create, Create,
Update, Update,
} }
#[derive(Debug)] #[derive(Debug, Clone, PartialEq)]
pub struct Wiki { pub struct Wiki {
pub action: WikiAction, pub action: WikiAction,
pub repository: Repository, pub repository: Repository,
@ -131,7 +131,7 @@ pub struct Wiki {
/// Lowest common denominator struct so that we don't have to duplicate our code for each platform /// Lowest common denominator struct so that we don't have to duplicate our code for each platform
/// we support. /// we support.
#[derive(Debug)] #[derive(Debug, Clone, PartialEq)]
pub enum Hook { pub enum Hook {
/// Push event /// Push event
Push(Push), Push(Push),