Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit 9908e1a

Browse files
committed
Use derive_more
1 parent 4fbcf9a commit 9908e1a

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ license = "MIT"
1818
chrono = { version = "0.4", features = ["serde"] }
1919
hex = "0.3"
2020
serde = { version = "1", features = ["derive"] }
21+
derive_more = "0.14"

src/events.rs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use serde::{
2626
de::{self, Deserializer},
2727
Deserialize,
2828
};
29+
use derive_more::From;
2930

3031
use std::fmt;
3132
use std::str::FromStr;
@@ -344,7 +345,7 @@ impl fmt::Display for EventType {
344345
///
345346
/// For documentation on each of these events, see:
346347
/// https://developer.github.com/v3/activity/events/types/
347-
#[derive(Deserialize, Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
348+
#[derive(Deserialize, From, Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
348349
#[allow(clippy::large_enum_variant)]
349350
pub enum Event {
350351
Ping(PingEvent),
@@ -361,8 +362,8 @@ pub enum Event {
361362
Gollum(GollumEvent),
362363
Installation(InstallationEvent),
363364
InstallationRepositories(InstallationRepositoriesEvent),
364-
IntegrationInstallation(InstallationEvent),
365-
IntegrationInstallationRepositories(InstallationRepositoriesEvent),
365+
IntegrationInstallation(IntegrationInstallationEvent),
366+
IntegrationInstallationRepositories(IntegrationInstallationRepositoriesEvent),
366367
IssueComment(IssueCommentEvent),
367368
Issues(IssuesEvent),
368369
Label(LabelEvent),
@@ -702,6 +703,26 @@ impl AppEvent for InstallationRepositoriesEvent {
702703
}
703704
}
704705

706+
/// Event deprecated by GitHub. Use `InstallationEvent` instead.
707+
#[derive(Deserialize, Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
708+
pub struct IntegrationInstallationEvent;
709+
710+
impl AppEvent for IntegrationInstallationEvent {
711+
fn installation(&self) -> Option<u64> {
712+
None
713+
}
714+
}
715+
716+
/// Event deprecated by GitHub. Use `InstallationRepositoriesEvent` instead.
717+
#[derive(Deserialize, Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
718+
pub struct IntegrationInstallationRepositoriesEvent;
719+
720+
impl AppEvent for IntegrationInstallationRepositoriesEvent {
721+
fn installation(&self) -> Option<u64> {
722+
None
723+
}
724+
}
725+
705726
#[derive(
706727
Deserialize, Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash,
707728
)]

0 commit comments

Comments
 (0)