Commit 9ac9bd7c authored by Ben Boeckel's avatar Ben Boeckel
Browse files

style: place doc comments before attributes

Better than splitting them up since the attributes are more strongly
related to the item than the documentation.
parent 8500acad
......@@ -186,8 +186,8 @@ impl Debug for Gitlab {
}
}
#[derive(Debug)]
/// Optional information for commit statuses.
#[derive(Debug)]
pub struct CommitStatusInfo<'a> {
/// The refname of the commit being tested.
pub refname: Option<&'a str>,
......@@ -199,8 +199,8 @@ pub struct CommitStatusInfo<'a> {
pub description: Option<&'a str>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
/// Optional information for merge requests.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum MergeRequestStateFilter {
/// Get the opened/reopened merge requests.
Opened,
......@@ -1183,10 +1183,10 @@ impl Gitlab {
self.post(format!("projects/{}/pipelines/{}/cancel", project, id))
}
#[allow(unused)]
/// Delete a pipeline.
///
/// NOTE Not implemented.
#[allow(unused)]
fn delete_pipeline(&self, project: ProjectId, id: PipelineId) -> GitlabResult<Pipeline> {
unimplemented!();
}
......
......@@ -18,8 +18,8 @@ use crates::serde_json::{self, Value};
use systemhooks::SystemHook;
use webhooks::WebHook;
#[derive(Debug, Clone)]
/// A deserializable structure for all Gitlab hooks.
#[derive(Debug, Clone)]
pub enum GitlabHook {
/// A system hook.
System(SystemHook),
......
......@@ -20,8 +20,8 @@ use crates::serde_json::{self, Value};
use types::{AccessLevel, GroupId, ObjectId, ProjectId, SshKeyId, UserId};
use webhooks::{CommitHookAttrs, ProjectHookAttrs};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
/// Events which occur at the project level.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ProjectEvent {
/// A project was created.
Create,
......@@ -39,8 +39,8 @@ enum_serialize!(ProjectEvent -> "project event",
Transfer => "project_transfer",
);
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
/// Visibility levels for projects.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ProjectVisibility {
/// The project is only visible to users who are logged in.
Internal,
......@@ -55,8 +55,8 @@ enum_serialize!(ProjectVisibility -> "project visibility",
Public => "public" ; "visibilitylevel|public",
);
#[derive(Serialize, Deserialize, Debug, Clone)]
/// A hook for a project.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ProjectSystemHook {
/// The event which occurred.
pub event_name: ProjectEvent,
......@@ -83,8 +83,8 @@ pub struct ProjectSystemHook {
pub old_path_with_namespace: Option<String>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
/// Events which occur when users are added and removed from projects.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ProjectMemberEvent {
/// A user was added to a project.
Add,
......@@ -96,8 +96,8 @@ enum_serialize!(ProjectMemberEvent -> "project member event",
Remove => "user_remove_from_team",
);
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
/// Access levels for groups and projects.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum HumanAccessLevel {
/// Guest access (can see the project).
Guest,
......@@ -130,8 +130,8 @@ impl From<HumanAccessLevel> for AccessLevel {
}
}
#[derive(Serialize, Deserialize, Debug, Clone)]
/// A project membership hook.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ProjectMemberSystemHook {
/// The event which occurred.
pub event_name: ProjectMemberEvent,
......@@ -161,8 +161,8 @@ pub struct ProjectMemberSystemHook {
pub project_visibility: ProjectVisibility,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
/// Events which occur for user accounts.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum UserEvent {
/// The user account was created.
Create,
......@@ -174,8 +174,8 @@ enum_serialize!(UserEvent -> "user event",
Destroy => "user_destroy",
);
#[derive(Serialize, Deserialize, Debug, Clone)]
/// A user hook.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct UserSystemHook {
/// The event which occurred.
pub event_name: UserEvent,
......@@ -193,8 +193,8 @@ pub struct UserSystemHook {
pub username: String,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
/// Events which occur for SSH keys.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum KeyEvent {
/// An SSH key was uploaded.
Create,
......@@ -206,8 +206,8 @@ enum_serialize!(KeyEvent -> "key event",
Destroy => "key_destroy",
);
#[derive(Serialize, Deserialize, Debug, Clone)]
/// An SSH key hook.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct KeySystemHook {
/// The event which occurred.
pub event_name: KeyEvent,
......@@ -223,8 +223,8 @@ pub struct KeySystemHook {
pub id: SshKeyId,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
/// Events which occur for groups.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum GroupEvent {
/// The group was created.
Create,
......@@ -236,8 +236,8 @@ enum_serialize!(GroupEvent -> "group event",
Destroy => "group_destroy",
);
#[derive(Serialize, Deserialize, Debug, Clone)]
/// A group hook.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct GroupSystemHook {
/// The event which occurred.
pub event_name: GroupEvent,
......@@ -257,8 +257,8 @@ pub struct GroupSystemHook {
pub owner_name: Option<String>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
/// Events which occur for group memberships.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum GroupMemberEvent {
/// A user was added to the group.
Add,
......@@ -270,8 +270,8 @@ enum_serialize!(GroupMemberEvent -> "group member event",
Remove => "user_remove_from_group",
);
#[derive(Serialize, Deserialize, Debug, Clone)]
/// A group membership hook.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct GroupMemberSystemHook {
/// The event which occurred.
pub event_name: GroupMemberEvent,
......@@ -297,8 +297,8 @@ pub struct GroupMemberSystemHook {
pub group_access: HumanAccessLevel,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
/// Events which occur when a push happens.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum PushEvent {
/// A non-tag push occurred.
Push,
......@@ -310,8 +310,8 @@ enum_serialize!(PushEvent -> "push event",
TagPush => "tag_push",
);
#[derive(Serialize, Deserialize, Debug, Clone)]
/// A push hook.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct PushSystemHook {
/// The event which occurred.
pub event_name: PushEvent,
......@@ -353,8 +353,8 @@ pub struct PushSystemHook {
repository: Value,
}
#[derive(Debug, Clone)]
/// A deserializable structure for all Gitlab system hooks.
#[derive(Debug, Clone)]
pub enum SystemHook {
/// A project hook.
Project(ProjectSystemHook),
......
This diff is collapsed.
......@@ -22,11 +22,11 @@ use types::{
SnippetId, UserId,
};
#[derive(Debug, Clone, Copy)]
/// A wrapper struct for dates in web hooks.
///
/// Gitlab does not use a standard date format for dates in web hooks. This structure supports
/// deserializing the formats that have been observed.
#[derive(Debug, Clone, Copy)]
pub struct HookDate(DateTime<Utc>);
impl Serialize for HookDate {
......@@ -64,8 +64,8 @@ impl AsRef<DateTime<Utc>> for HookDate {
}
}
#[derive(Serialize, Deserialize, Debug, Clone)]
/// Project information exposed in hooks.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ProjectHookAttrs {
/// The display name of the project.
pub name: String,
......@@ -93,8 +93,8 @@ pub struct ProjectHookAttrs {
url: String,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
/// Wiki project information exposed in hooks.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ProjectWikiHookAttrs {
/// The URL for the project's homepage.
pub web_url: String,
......@@ -108,8 +108,8 @@ pub struct ProjectWikiHookAttrs {
pub default_branch: String,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
/// User information exposed in hooks.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct UserHookAttrs {
/// The name of the user.
pub name: String,
......@@ -119,8 +119,8 @@ pub struct UserHookAttrs {
pub avatar_url: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
/// The identity of a user exposed through a hook.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct HookCommitIdentity {
/// The name of the author or committer.
pub name: String,
......@@ -128,8 +128,8 @@ pub struct HookCommitIdentity {
pub email: String,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
/// Commit information exposed in hooks.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct CommitHookAttrs {
/// The commit's ID.
pub id: ObjectId,
......@@ -145,8 +145,8 @@ pub struct CommitHookAttrs {
pub removed: Option<Vec<String>>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
/// A push hook.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct PushHook {
/// The event which occurred.
pub object_kind: String,
......@@ -186,8 +186,8 @@ pub struct PushHook {
repository: Value,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
/// Actions which may occur on an issue.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum IssueAction {
/// The issue was updated.
Update,
......@@ -205,8 +205,8 @@ enum_serialize!(IssueAction -> "issue action",
Reopen => "reopen",
);
#[derive(Serialize, Deserialize, Debug, Clone)]
/// Issue information exposed in hooks.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct IssueHookAttrs {
/// The ID of the issue.
pub id: IssueId,
......@@ -259,8 +259,8 @@ pub struct IssueHookAttrs {
pub action: Option<IssueAction>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
/// An issue hook.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct IssueHook {
/// The event which occurred.
pub object_kind: String,
......@@ -274,8 +274,8 @@ pub struct IssueHook {
pub assignee: Option<UserHookAttrs>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
/// Actions which may occur on a merge request.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum MergeRequestAction {
/// The merge request was updated.
Update,
......@@ -296,8 +296,8 @@ enum_serialize!(MergeRequestAction -> "merge request action",
Merge => "merge",
);
#[derive(Serialize, Deserialize, Debug, Clone)]
/// Merge parameters for a merge request.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct MergeRequestParams {
force_remove_source_branch: Option<Value>, // sigh
}
......@@ -323,8 +323,8 @@ impl MergeRequestParams {
}
}
#[derive(Serialize, Deserialize, Debug, Clone)]
/// Merge request information exposed in hooks.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct MergeRequestHookAttrs {
/// The source project of the merge request.
///
......@@ -396,8 +396,8 @@ pub struct MergeRequestHookAttrs {
lock_version: Option<u64>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
/// A merge request hook.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct MergeRequestHook {
/// The event which occurred.
pub object_kind: String,
......@@ -412,8 +412,8 @@ pub struct MergeRequestHook {
repository: Value,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
/// The type of a snippet.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SnippetType {
/// A project-owned snippet.
Project,
......@@ -425,8 +425,8 @@ enum_serialize!(SnippetType -> "snippet type",
Personal => "PersonalSnippet",
);
#[derive(Serialize, Deserialize, Debug, Clone)]
/// Snippet information exposed in hooks.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct SnippetHookAttrs {
/// The title of the snippet.
pub title: String,
......@@ -449,8 +449,8 @@ pub struct SnippetHookAttrs {
pub visibility_level: u64,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
/// Actions which may occur on a wiki page.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum WikiPageAction {
/// A wiki page was created.
Create,
......@@ -462,8 +462,8 @@ enum_serialize!(WikiPageAction -> "wiki page action",
Update => "update",
);
#[derive(Serialize, Deserialize, Debug, Clone)]
/// Wiki information exposed in hooks.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct WikiPageHookAttrs {
/// The title of the wiki page.
pub title: String,
......@@ -480,8 +480,8 @@ pub struct WikiPageHookAttrs {
pub action: WikiPageAction,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
/// Diff information exposed in hooks.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct DiffHookAttrs {
pub diff: String,
/// The path on the new side of the diff.
......@@ -517,8 +517,8 @@ pub struct PositionHookAttrs {
pub new_path: String,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
/// Note (comment) information exposed in hooks.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct NoteHookAttrs {
/// The ID of the note.
pub id: NoteId,
......@@ -592,8 +592,8 @@ impl NoteHookAttrs {
}
}
#[derive(Serialize, Deserialize, Debug, Clone)]
/// A note hook.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct NoteHook {
/// The event which occurred.
pub object_kind: String,
......@@ -616,8 +616,8 @@ pub struct NoteHook {
repository: Value,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
/// Build user information exposed in hooks.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct BuildUserHookAttrs {
/// The ID of the user.
pub id: Option<UserId>,
......@@ -627,8 +627,8 @@ pub struct BuildUserHookAttrs {
pub email: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
/// Build commit information exposed in hooks.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct BuildCommitHookAttrs {
pub id: String,
/// The object ID of the commit.
......@@ -647,8 +647,8 @@ pub struct BuildCommitHookAttrs {
pub finished_at: Option<HookDate>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
/// Project information exposed in build hooks.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct BuildProjectHookAttrs {
/// The display name of the project.
pub name: String,
......@@ -664,8 +664,8 @@ pub struct BuildProjectHookAttrs {
pub visibility_level: u64,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
/// A build hook.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct BuildHook {
/// The event which occurred.
pub object_kind: String,
......@@ -698,8 +698,8 @@ pub struct BuildHook {
pub repository: BuildProjectHookAttrs,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
/// A wiki page hook.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct WikiPageHook {
/// The event which occurred.
pub object_kind: String,
......@@ -713,8 +713,8 @@ pub struct WikiPageHook {
pub object_attributes: WikiPageHookAttrs,
}
#[derive(Debug, Clone)]
/// A deserializable structure for all Gitlab web hooks.
#[derive(Debug, Clone)]
pub enum WebHook {
/// A push hook.
Push(PushHook),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment