Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

derive setters for spec and mount #76

Merged
merged 2 commits into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/runtime/miscellaneous.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::error::OciSpecError;
use derive_builder::Builder;
use getset::{CopyGetters, Getters};
use getset::{CopyGetters, Getters, Setters};
use serde::{Deserialize, Serialize};
use std::path::PathBuf;

Expand Down Expand Up @@ -37,14 +37,16 @@ impl Default for Root {
}
}

#[derive(Builder, Clone, Debug, Default, Deserialize, Eq, Getters, PartialEq, Serialize)]
#[derive(
Builder, Clone, Debug, Default, Deserialize, Eq, Getters, Setters, PartialEq, Serialize,
)]
#[builder(
default,
pattern = "owned",
setter(into, strip_option),
build_fn(error = "OciSpecError")
)]
#[getset(get = "pub")]
#[getset(get = "pub", set = "pub")]
/// Mount specifies a mount for a container.
pub struct Mount {
/// Destination is the absolute path where the mount will be placed in
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! [OCI runtime spec](https://github.com/opencontainers/runtime-spec) types and definitions.

use derive_builder::Builder;
use getset::Getters;
use getset::{Getters, Setters};
use serde::{Deserialize, Serialize};
use std::{
collections::HashMap,
Expand Down Expand Up @@ -34,14 +34,14 @@ pub use vm::*;
pub use windows::*;

/// Base configuration for the container.
#[derive(Builder, Clone, Debug, Deserialize, Getters, PartialEq, Serialize)]
#[derive(Builder, Clone, Debug, Deserialize, Getters, Setters, PartialEq, Serialize)]
#[builder(
default,
pattern = "owned",
setter(into, strip_option),
build_fn(error = "OciSpecError")
)]
#[getset(get = "pub")]
#[getset(get = "pub", set = "pub")]
pub struct Spec {
#[serde(default, rename = "ociVersion")]
/// MUST be in SemVer v2.0.0 format and specifies the version of the
Expand Down