Skip to content

Commit

Permalink
revise: makes most structs Clone
Browse files Browse the repository at this point in the history
  • Loading branch information
claymcleod committed Sep 21, 2024
1 parent abb2e06 commit 40a40b4
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/v1/client/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl std::fmt::Display for Error {
pub type Result<T> = std::result::Result<T, Error>;

/// A builder for a [`Client`](Client).
#[derive(Debug, Default)]
#[derive(Clone, Debug, Default)]
pub struct Builder {
/// The base URL for the requests.
url: Option<Url>,
Expand Down
2 changes: 1 addition & 1 deletion src/v1/client/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use reqwest::header::HeaderMap;
const DEFAULT_RETRIES: u32 = 3;

/// Options used within a [`Client`](super::Client).
#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct Options {
/// Headers to include in each request.
pub headers: HeaderMap,
Expand Down
2 changes: 1 addition & 1 deletion src/v1/client/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// An argument that affects which fields are returned on certain task-related
/// endpoints.
#[derive(Debug, Default, Eq, PartialEq)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "UPPERCASE"))]
pub enum View {
Expand Down
4 changes: 2 additions & 2 deletions src/v1/types/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ pub mod task;
pub use service::ServiceInfo;

/// A response from `POST /tasks`.
#[derive(Debug, Default, Eq, PartialEq)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct CreateTask {
/// The ID of the created task.
pub id: String,
}

/// The response from `GET /tasks`.
#[derive(Debug, Default, Eq, PartialEq)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct ListTasks<Task> {
/// The tasks in this page of results.
Expand Down
8 changes: 4 additions & 4 deletions src/v1/types/responses/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use url::Url;
///
/// Note that, in the case of the Task Execution Service specification, this can
/// only be `"tes"` but it's still technically listed as an enum.
#[derive(Debug, Default, Eq, PartialEq)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Artifact {
/// A task execution service.
Expand All @@ -18,7 +18,7 @@ pub enum Artifact {
}

/// An organization provided a TES service.
#[derive(Debug, Eq, PartialEq)]
#[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Organization {
/// The organization name.
Expand All @@ -29,7 +29,7 @@ pub struct Organization {
}

/// A type of service.
#[derive(Debug, Default, Eq, PartialEq)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct ServiceType {
/// Namespace in reverse domain name format.
Expand All @@ -43,7 +43,7 @@ pub struct ServiceType {
}

/// A set of service information for the server.
#[derive(Debug, Eq, PartialEq)]
#[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
pub struct ServiceInfo {
Expand Down
4 changes: 2 additions & 2 deletions src/v1/types/responses/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::v1::types::task::State;
use crate::v1::types::Task;

/// A response for when `?view=MINIMAL` in a task endpoint.
#[derive(Debug, Default, Eq, PartialEq)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct MinimalTask {
/// The ID.
Expand All @@ -15,7 +15,7 @@ pub struct MinimalTask {
}

/// A generalized response for getting tasks with the `view` parameter.
#[derive(Debug, Eq, PartialEq)]
#[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(untagged))]
pub enum Response {
Expand Down
14 changes: 7 additions & 7 deletions src/v1/types/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub mod file;
pub use executor::Executor;

/// State of TES task.
#[derive(Debug, Default, Eq, PartialEq)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "UPPERCASE"))]
pub enum State {
Expand Down Expand Up @@ -58,7 +58,7 @@ impl State {
}

/// An input for a TES task.
#[derive(Debug, Default, Eq, PartialEq)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Input {
/// An optional name.
Expand All @@ -82,7 +82,7 @@ pub struct Input {
}

/// An output for a TES task.
#[derive(Debug, Default, Eq, PartialEq)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Output {
/// An optional name.
Expand All @@ -103,7 +103,7 @@ pub struct Output {
}

/// Requested resources for a TES task.
#[derive(Debug, Default, Eq, PartialEq)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Resources {
/// The number of CPU cores.
Expand All @@ -123,7 +123,7 @@ pub struct Resources {
}

/// An output file log.
#[derive(Debug, Default, Eq, PartialEq)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct OutputFileLog {
/// The URL.
Expand All @@ -137,7 +137,7 @@ pub struct OutputFileLog {
}

/// A task log.
#[derive(Debug, Default, Eq, PartialEq)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct TaskLog {
/// The executor logs.
Expand All @@ -157,7 +157,7 @@ pub struct TaskLog {
}

/// A task.
#[derive(Debug, Default, Eq, PartialEq)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Task {
/// The ID.
Expand Down
4 changes: 2 additions & 2 deletions src/v1/types/task/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use chrono::Utc;
/// In short, an executor is a single command that is run in a different
/// container image. [`Executor`]s are run sequentially as they are specified in
/// the task.
#[derive(Debug, Default, Eq, PartialEq)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Executor {
/// The image.
Expand All @@ -36,7 +36,7 @@ pub struct Executor {
}

/// A log for an [`Executor`].
#[derive(Debug, Default, Eq, PartialEq)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Log {
/// The start time.
Expand Down
2 changes: 1 addition & 1 deletion src/v1/types/task/file.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Files declared within tasks.
/// A type of file.
#[derive(Debug, Default, Eq, PartialEq)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Type {
/// A file.
Expand Down

0 comments on commit 40a40b4

Please sign in to comment.