An update will be applied December 9th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit 5d74b2ba authored by Makoto Nakashima's avatar Makoto Nakashima
Browse files

Use enum_serialize! for as_str method and derives more traits.

parent c8361223
......@@ -11,7 +11,8 @@ use self::ease::Error as EaseError;
use self::ease::{Request, Response, Url};
extern crate serde;
use self::serde::Deserialize;
use self::serde::{Deserialize, Deserializer, Serialize, Serializer};
use self::serde::de::Error as SerdeError;
extern crate serde_json;
......@@ -57,7 +58,7 @@ pub struct CommitStatusInfo<'a> {
pub description: Option<&'a str>,
}
#[derive(Debug)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
/// Optional information for merge requests.
pub enum MergeRequestStateFilter {
/// Get the opened/reopened merge requests.
......@@ -67,16 +68,12 @@ pub enum MergeRequestStateFilter {
/// Get the merged merge requests.
Merged,
}
impl MergeRequestStateFilter {
fn as_str(&self) -> &str {
use self::MergeRequestStateFilter::*;
match *self {
Opened => "opened",
Closed => "closed",
Merged => "merged",
}
}
}
enum_serialize!(MergeRequestStateFilter -> "state",
Opened => "opened",
Closed => "closed",
Merged => "merged",
);
impl Gitlab {
/// Create a new Gitlab API representation.
......
......@@ -20,10 +20,10 @@ extern crate log;
extern crate quick_error;
mod error;
mod gitlab;
#[macro_use]
mod macros;
mod gitlab;
pub mod systemhooks;
pub mod types;
pub mod webhooks;
......
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