Skip to content

Commit

Permalink
feat: Implement Clone for option types (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsided authored Jun 6, 2024
1 parent 6136170 commit 84ef422
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/collection/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use typed_builder::TypedBuilder;
use crate::collection::CollectionType;

/// Options for create a collection
#[derive(Serialize, PartialEq, TypedBuilder)]
#[derive(Serialize, PartialEq, TypedBuilder, Clone)]
#[builder(doc)]
#[serde(rename_all = "camelCase")]
pub struct CreateParameters {
Expand Down Expand Up @@ -39,7 +39,7 @@ where
}
}
/// Options for create a collection
#[derive(Serialize, PartialEq, TypedBuilder)]
#[derive(Serialize, PartialEq, TypedBuilder, Clone)]
#[builder(doc)]
#[serde(rename_all = "camelCase")]
pub struct CreateOptions<'a> {
Expand Down Expand Up @@ -221,7 +221,7 @@ fn is_true(x: &bool) -> bool {
*x
}

#[derive(Debug, Deserialize, Serialize, TypedBuilder, PartialEq)]
#[derive(Debug, Deserialize, Serialize, TypedBuilder, PartialEq, Clone)]
#[builder(doc)]
#[serde(rename_all = "camelCase")]
pub struct KeyOptions {
Expand Down Expand Up @@ -263,7 +263,7 @@ impl Default for KeyOptions {
}

/// Options for checksum
#[derive(Serialize, Deserialize, PartialEq, TypedBuilder)]
#[derive(Serialize, Deserialize, PartialEq, TypedBuilder, Clone)]
#[builder(doc)]
#[serde(rename_all = "camelCase")]
pub struct ChecksumOptions {
Expand All @@ -290,7 +290,7 @@ impl Default for ChecksumOptions {
}
}

#[derive(Debug, Deserialize, Serialize, TypedBuilder)]
#[derive(Debug, Deserialize, Serialize, TypedBuilder, Clone)]
#[builder(doc)]
#[serde(rename_all = "camelCase")]
pub struct PropertiesOptions {
Expand Down
2 changes: 1 addition & 1 deletion src/connection/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use typed_builder::TypedBuilder;
use std::collections::HashMap;

/// Options for create a collection
#[derive(Serialize, PartialEq, TypedBuilder)]
#[derive(Serialize, PartialEq, TypedBuilder, Clone)]
#[builder(doc)]
#[serde(rename_all = "camelCase")]
#[cfg(feature = "cluster")]
Expand Down
12 changes: 6 additions & 6 deletions src/document/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;

/// Options for document insertion.
#[derive(Debug, Serialize, Deserialize, PartialEq, TypedBuilder)]
#[derive(Debug, Serialize, Deserialize, PartialEq, TypedBuilder, Clone)]
#[builder(doc)]
#[serde(rename_all = "camelCase")]
pub struct InsertOptions {
Expand Down Expand Up @@ -70,7 +70,7 @@ impl Default for InsertOptions {
}

/// Options for document update,
#[derive(Debug, Serialize, Deserialize, PartialEq, TypedBuilder)]
#[derive(Debug, Serialize, Deserialize, PartialEq, TypedBuilder, Clone)]
#[builder(doc)]
#[serde(rename_all = "camelCase")]
pub struct UpdateOptions {
Expand Down Expand Up @@ -124,7 +124,7 @@ impl Default for UpdateOptions {
}
}

#[derive(Debug, Serialize, Deserialize, PartialEq)]
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
#[serde(rename_all = "camelCase")]
pub enum OverwriteMode {
/// If a document with the specified _key value exists already,
Expand Down Expand Up @@ -166,7 +166,7 @@ pub enum OverwriteMode {
}

/// Options for document replace,
#[derive(Debug, Serialize, Deserialize, TypedBuilder)]
#[derive(Debug, Serialize, Deserialize, TypedBuilder, Clone)]
#[builder(doc)]
#[serde(rename_all = "camelCase")]
pub struct ReplaceOptions {
Expand Down Expand Up @@ -206,7 +206,7 @@ impl Default for ReplaceOptions {
}

/// Options for document reading.
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub enum ReadOptions {
/// If the “If-None-Match” header is given, then it must contain exactly one
Expand All @@ -227,7 +227,7 @@ impl Default for ReadOptions {
}

/// Options for document removes,
#[derive(Debug, Serialize, Deserialize, TypedBuilder)]
#[derive(Debug, Serialize, Deserialize, TypedBuilder, Clone)]
#[builder(doc)]
#[serde(rename_all = "camelCase")]
pub struct RemoveOptions {
Expand Down

0 comments on commit 84ef422

Please sign in to comment.