aboutsummaryrefslogtreecommitdiffstats
path: root/rust/src/api_helpers.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-09-11 16:10:47 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-09-11 16:10:47 -0700
commit91c080a2e82ec4e8908cb8e3916a543519151847 (patch)
tree1d6f450546bcd0d0888bd0f4ec52d66a8a3cfd0f /rust/src/api_helpers.rs
parent6315c314969d4e66db4da09a8c2ff245aafe0fc1 (diff)
downloadfatcat-91c080a2e82ec4e8908cb8e3916a543519151847.tar.gz
fatcat-91c080a2e82ec4e8908cb8e3916a543519151847.zip
implement new editgroup_id behavior
Diffstat (limited to 'rust/src/api_helpers.rs')
-rw-r--r--rust/src/api_helpers.rs41
1 files changed, 25 insertions, 16 deletions
diff --git a/rust/src/api_helpers.rs b/rust/src/api_helpers.rs
index ee1f9f14..f260d25f 100644
--- a/rust/src/api_helpers.rs
+++ b/rust/src/api_helpers.rs
@@ -21,7 +21,7 @@ pub struct EditContext {
pub autoaccept: bool,
}
-#[derive(Clone,Copy,PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
pub struct ExpandFlags {
pub files: bool,
pub container: bool,
@@ -30,7 +30,6 @@ pub struct ExpandFlags {
}
impl ExpandFlags {
-
pub fn from_string(param: &str) -> ExpandFlags {
let list: Vec<&str> = param.split_terminator(",").collect();
ExpandFlags::from_strings(&list)
@@ -72,24 +71,34 @@ fn test_expand_flags() {
assert!(ExpandFlags::from_strings(&vec![]).files == false);
assert!(ExpandFlags::from_strings(&vec!["files"]).files == true);
assert!(ExpandFlags::from_strings(&vec!["file"]).files == false);
- let all = ExpandFlags::from_strings(&vec!["files", "container", "other_thing", "releases", "creators"]);
- assert!(all == ExpandFlags {
- files: true,
- container: true,
- releases: true,
- creators: true
- });
+ let all = ExpandFlags::from_strings(&vec![
+ "files",
+ "container",
+ "other_thing",
+ "releases",
+ "creators",
+ ]);
+ assert!(
+ all == ExpandFlags {
+ files: true,
+ container: true,
+ releases: true,
+ creators: true
+ }
+ );
assert!(ExpandFlags::from_string("").files == false);
assert!(ExpandFlags::from_string("files").files == true);
assert!(ExpandFlags::from_string("something,,files").files == true);
assert!(ExpandFlags::from_string("file").files == false);
let all = ExpandFlags::from_string("files,container,other_thing,releases,creators");
- assert!(all == ExpandFlags {
- files: true,
- container: true,
- releases: true,
- creators: true
- });
+ assert!(
+ all == ExpandFlags {
+ files: true,
+ container: true,
+ releases: true,
+ creators: true
+ }
+ );
assert!(all == ExpandFlags::all());
}
@@ -169,7 +178,7 @@ pub fn accept_editgroup(editgroup_id: FatCatId, conn: &DbConn) -> Result<Changel
Ok(entry)
}
-#[derive(Clone,Copy,PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
pub struct FatCatId(Uuid);
impl ToString for FatCatId {