Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nicholas Bailey
rust-gitlab
Commits
7b5b1168
Commit
7b5b1168
authored
May 28, 2020
by
Ben Boeckel
⛰
Browse files
api/common: impl From<bool> for EnableState
parent
09277528
Changes
5
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
7b5b1168
...
...
@@ -6,6 +6,7 @@
changed to match the actual API exposed by GitLab (with
`None`
and
`Any`
options).
*
The
`api::projects::pipelines::PipelineVariables`
endpoint is now pageable.
*
All
`EnableState`
fields may now be set using
`bool`
values.
# v0.1210.2
...
...
src/api/common.rs
View file @
7b5b1168
...
...
@@ -113,6 +113,16 @@ impl EnableState {
}
}
impl
From
<
bool
>
for
EnableState
{
fn
from
(
b
:
bool
)
->
Self
{
if
b
{
EnableState
::
Enabled
}
else
{
EnableState
::
Disabled
}
}
}
impl
ParamValue
<
'static
>
for
EnableState
{
fn
as_value
(
self
)
->
Cow
<
'static
,
str
>
{
self
.as_str
()
.into
()
...
...
@@ -315,6 +325,15 @@ mod tests {
}
}
#[test]
fn
enable_state_from_bool
()
{
let
items
=
&
[(
EnableState
::
Enabled
,
true
),
(
EnableState
::
Disabled
,
false
)];
for
(
i
,
s
)
in
items
{
assert_eq!
(
*
i
,
(
*
s
)
.into
());
}
}
#[test]
fn
name_or_id_as_str
()
{
let
items
:
&
[(
NameOrId
,
_
)]
=
&
[
...
...
src/api/projects/create.rs
View file @
7b5b1168
...
...
@@ -504,7 +504,7 @@ pub struct CreateProject<'a> {
build_timeout
:
Option
<
u64
>
,
/// Whether to automatically cancel pipelines when branches are updated when using a previous
/// version of th branch.
#[builder(default)]
#[builder(
setter(into),
default)]
auto_cancel_pending_pipelines
:
Option
<
EnableState
>
,
/// The default regular expression to use for build coverage extraction.
#[builder(setter(into),
default)]
...
...
src/api/projects/edit.rs
View file @
7b5b1168
...
...
@@ -127,7 +127,7 @@ pub struct EditProject<'a> {
build_timeout
:
Option
<
u64
>
,
/// Whether to automatically cancel pipelines when branches are updated when using a previous
/// version of th branch.
#[builder(default)]
#[builder(
setter(into),
default)]
auto_cancel_pending_pipelines
:
Option
<
EnableState
>
,
/// The default regular expression to use for build coverage extraction.
#[builder(setter(into),
default)]
...
...
src/api/users/users.rs
View file @
7b5b1168
...
...
@@ -118,7 +118,7 @@ pub struct Users<'a> {
#[builder(default)]
sort
:
Option
<
SortOrder
>
,
/// Return users with a two-factor enabled or not.
#[builder(default)]
#[builder(
setter(into),
default)]
two_factor
:
Option
<
EnableState
>
,
/// If set to `true`, filter out users without any projects.
#[builder(default)]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment