Skip to content

Commit

Permalink
Take advantage of the derive builder crate (#91)
Browse files Browse the repository at this point in the history
* Leverage derive-builder

* Assertions on built client

* Add Debug trait to Client

* Adjust demo project
  • Loading branch information
leplatrem authored Mar 22, 2021
1 parent 4335240 commit caa960d
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 126 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ url = "2.1"
viaduct = { git = "https://github.com/mozilla/application-services", rev = "v74.0.1"}
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
derive_builder = "0.9"
thiserror = "1.0"

# ring_verifier
Expand Down
9 changes: 6 additions & 3 deletions rs-client-demo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ fn main() {

let mut client = Client::builder()
.collection_name("url-classifier-skip-urls")
.build();
.build()
.unwrap();

match client.get() {
Ok(records) => println!("{} records.", records.len()),
Expand All @@ -48,7 +49,8 @@ fn main() {
let mut client_with_custom_verifier = Client::builder()
.collection_name("url-classifier-skip-urls")
.verifier(Box::new(CustomVerifier {}))
.build();
.build()
.unwrap();

match client_with_custom_verifier.get() {
Ok(records) => println!("{} records.", records.len()),
Expand All @@ -69,7 +71,8 @@ fn main() {
.bucket_name(&collection.bucket)
.collection_name(&collection.collection)
.storage(Box::new(FileStorage { folder: "/tmp".into(), ..FileStorage::default() }))
.build();
.build()
.unwrap();

match client.get() {
Ok(records) => println!("{} records.", records.len()),
Expand Down
Loading

0 comments on commit caa960d

Please sign in to comment.