From 38b366204b8b98174027a74f5a956795ca60a147 Mon Sep 17 00:00:00 2001 From: pep Date: Wed, 4 Sep 2024 20:38:48 +0200 Subject: [PATCH] forgejo-hooks: cargo fmt Signed-off-by: pep --- forgejo-hooks/src/lib.rs | 265 +++++++++++++++++++-------------------- 1 file changed, 132 insertions(+), 133 deletions(-) diff --git a/forgejo-hooks/src/lib.rs b/forgejo-hooks/src/lib.rs index 2367dc3..758ba12 100644 --- a/forgejo-hooks/src/lib.rs +++ b/forgejo-hooks/src/lib.rs @@ -1,187 +1,186 @@ - use serde::Deserialize; #[derive(Deserialize, Debug)] pub struct CommitAuthor { - pub name: String, - pub email: String, - pub username: String, + pub name: String, + pub email: String, + pub username: String, } #[derive(Deserialize, Debug)] pub struct User { - pub id: u32, - pub login: String, - pub full_name: String, - pub email: String, - pub avatar_url: String, - pub username: String, + pub id: u32, + pub login: String, + pub full_name: String, + pub email: String, + pub avatar_url: String, + pub username: String, } #[derive(Deserialize, Debug)] pub struct Commit { - pub id: String, - pub message: String, - pub url: String, - pub author: CommitAuthor, - pub committer: CommitAuthor, - pub timestamp: String, + pub id: String, + pub message: String, + pub url: String, + pub author: CommitAuthor, + pub committer: CommitAuthor, + pub timestamp: String, } #[derive(Deserialize, Debug)] pub struct Perms { - admin: bool, - push: bool, - pull: bool, + admin: bool, + push: bool, + pull: bool, } #[derive(Deserialize, Debug)] pub struct InternalTracker { - enable_time_tracker: bool, - allow_only_contributors_to_track_time: bool, - enable_issue_dependencies: bool + enable_time_tracker: bool, + allow_only_contributors_to_track_time: bool, + enable_issue_dependencies: bool, } #[derive(Deserialize, Debug)] pub struct Repository { - pub id: u32, - pub owner: User, - pub name: String, - pub full_name: String, - pub description: String, - pub private: bool, - pub fork: bool, - pub html_url: String, - pub ssh_url: String, - pub clone_url: String, - pub website: String, - pub stars_count: u32, - pub forks_count: u32, - pub watchers_count: u32, - pub open_issues_count: u32, - pub default_branch: String, - pub created_at: String, - pub updated_at: String, + pub id: u32, + pub owner: User, + pub name: String, + pub full_name: String, + pub description: String, + pub private: bool, + pub fork: bool, + pub html_url: String, + pub ssh_url: String, + pub clone_url: String, + pub website: String, + pub stars_count: u32, + pub forks_count: u32, + pub watchers_count: u32, + pub open_issues_count: u32, + pub default_branch: String, + pub created_at: String, + pub updated_at: String, } #[derive(Deserialize, Debug)] pub struct RepositoryFull { - pub id: u32, - pub owner: RepositoryOwner, - pub name: String, - pub full_name: String, - pub description: String, - pub empty: bool, - pub private: bool, - pub fork: bool, - pub template: bool, - pub parent: Option>, - pub mirror: bool, - pub size: u32, - pub language: String, - pub languages_url: String, - pub html_url: String, - pub url: String, - pub link: String, - pub ssh_url: String, - pub clone_url: String, - pub website: String, - pub stars_count: u32, - pub forks_count: u32, - pub watchers_count: u32, - pub open_issues_count: u32, - pub open_pr_counter: u32, - pub default_branch: String, - pub created_at: String, - pub updated_at: String, - pub archived_at: String, - pub permissions: Perms, - pub has_issues: bool, - pub internal_tracker: InternalTracker, - pub has_wiki: bool, - pub has_pull_requests: bool, - pub has_projects: bool, - pub has_releases: bool, - pub has_actions: bool, - pub ignore_whitespace_conflicts: bool, - pub allow_merge_commits: bool, - pub allow_rebase: bool, - pub allow_rebase_explicit: bool, - pub allow_squash_merge: bool, - pub allow_rebase_update: bool, - pub default_delete_branch_after_merge: bool, - pub default_merge_style: String, - pub default_allow_maintainer_edit: bool, - pub avatar_url: String, - pub internal: bool, - pub mirror_internal: String, - pub mirror_updated: String, - pub repo_transfer: Option, + pub id: u32, + pub owner: RepositoryOwner, + pub name: String, + pub full_name: String, + pub description: String, + pub empty: bool, + pub private: bool, + pub fork: bool, + pub template: bool, + pub parent: Option>, + pub mirror: bool, + pub size: u32, + pub language: String, + pub languages_url: String, + pub html_url: String, + pub url: String, + pub link: String, + pub ssh_url: String, + pub clone_url: String, + pub website: String, + pub stars_count: u32, + pub forks_count: u32, + pub watchers_count: u32, + pub open_issues_count: u32, + pub open_pr_counter: u32, + pub default_branch: String, + pub created_at: String, + pub updated_at: String, + pub archived_at: String, + pub permissions: Perms, + pub has_issues: bool, + pub internal_tracker: InternalTracker, + pub has_wiki: bool, + pub has_pull_requests: bool, + pub has_projects: bool, + pub has_releases: bool, + pub has_actions: bool, + pub ignore_whitespace_conflicts: bool, + pub allow_merge_commits: bool, + pub allow_rebase: bool, + pub allow_rebase_explicit: bool, + pub allow_squash_merge: bool, + pub allow_rebase_update: bool, + pub default_delete_branch_after_merge: bool, + pub default_merge_style: String, + pub default_allow_maintainer_edit: bool, + pub avatar_url: String, + pub internal: bool, + pub mirror_internal: String, + pub mirror_updated: String, + pub repo_transfer: Option, } #[derive(Deserialize, Debug)] pub struct RepositoryOwner { - pub id: u32, - pub login: String, - pub login_name: String, - pub full_name: String, - pub email: String, - pub avatar_url: String, - pub language: String, - pub is_admin: bool, - pub last_login: String, - pub created: String, - pub restricted: bool, - pub active: bool, - pub prohibit_login: bool, - pub location: String, - pub website: String, - pub description: String, - pub visibility: String, - pub followers_count: u32, - pub following_count: u32, - pub starred_repos_count: u32, - pub username: String, + pub id: u32, + pub login: String, + pub login_name: String, + pub full_name: String, + pub email: String, + pub avatar_url: String, + pub language: String, + pub is_admin: bool, + pub last_login: String, + pub created: String, + pub restricted: bool, + pub active: bool, + pub prohibit_login: bool, + pub location: String, + pub website: String, + pub description: String, + pub visibility: String, + pub followers_count: u32, + pub following_count: u32, + pub starred_repos_count: u32, + pub username: String, } #[derive(Deserialize, Debug)] pub struct Push { - #[serde(rename(deserialize = "ref"))] - pub ref_: String, - pub before: String, - pub compare_url: String, - pub commits: Vec, - pub repository: Repository, - pub pusher: User, - pub sender: User, + #[serde(rename(deserialize = "ref"))] + pub ref_: String, + pub before: String, + pub compare_url: String, + pub commits: Vec, + pub repository: Repository, + pub pusher: User, + pub sender: User, } #[derive(Deserialize, Debug)] pub enum RefType { - Branch, + Branch, } #[derive(Deserialize, Debug)] pub struct AddedBranch { - pub sha: String, - pub ref_type: String, - pub repository: Repository, - pub sender: RepositoryOwner, + pub sha: String, + pub ref_type: String, + pub repository: Repository, + pub sender: RepositoryOwner, } #[derive(Deserialize, Debug)] pub struct RemovedBranch { - pub sha: String, - pub ref_type: String, - pub pusher_type: String, - pub repository: Repository, - pub sender: RepositoryOwner, + pub sha: String, + pub ref_type: String, + pub pusher_type: String, + pub repository: Repository, + pub sender: RepositoryOwner, } #[derive(Deserialize, Debug)] #[serde(untagged)] pub enum Hook { - Push(Push), - AddedBranch(AddedBranch), - RemovedBranch(RemovedBranch), + Push(Push), + AddedBranch(AddedBranch), + RemovedBranch(RemovedBranch), }