Bump typify from `7ceddf6` to `1d8e828` (#684)

* Bump typify from `7ceddf6` to `1d8e828`

Bumps [typify](https://github.com/oxidecomputer/typify) from `7ceddf6` to `1d8e828`.
- [Commits](7ceddf6644...1d8e828f29)

---
updated-dependencies:
- dependency-name: typify
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* update fixtures

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Adam H. Leventhal <ahl@oxide.computer>
This commit is contained in:
dependabot[bot] 2024-01-11 10:50:00 -08:00 committed by GitHub
parent d3e89232a3
commit cd67545ee1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 2890 additions and 1967 deletions

68
Cargo.lock generated
View File

@ -125,7 +125,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.48",
]
[[package]]
@ -136,7 +136,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.48",
]
[[package]]
@ -326,7 +326,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.48",
]
[[package]]
@ -510,7 +510,7 @@ dependencies = [
"quote",
"serde",
"serde_tokenstream",
"syn 2.0.46",
"syn 2.0.48",
]
[[package]]
@ -587,7 +587,7 @@ dependencies = [
"reqwest",
"serde",
"serde_json",
"syn 2.0.46",
"syn 2.0.48",
"uuid",
]
@ -615,7 +615,7 @@ dependencies = [
"reqwest",
"serde",
"serde_json",
"syn 2.0.46",
"syn 2.0.48",
"uuid",
"wasm-bindgen-test",
]
@ -723,7 +723,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.48",
]
[[package]]
@ -1373,7 +1373,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5"
dependencies = [
"proc-macro2",
"syn 2.0.46",
"syn 2.0.48",
]
[[package]]
@ -1439,7 +1439,7 @@ dependencies = [
"serde",
"serde_json",
"serde_yaml",
"syn 2.0.46",
"syn 2.0.48",
"thiserror",
"typify",
"unicode-ident",
@ -1458,7 +1458,7 @@ dependencies = [
"serde_json",
"serde_tokenstream",
"serde_yaml",
"syn 2.0.46",
"syn 2.0.48",
]
[[package]]
@ -1811,22 +1811,22 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.193"
version = "1.0.195"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89"
checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.193"
version = "1.0.195"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.48",
]
[[package]]
@ -1842,9 +1842,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.109"
version = "1.0.111"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb0652c533506ad7a2e353cce269330d6afd8bdfb6d75e0ace5b35aacbd7b9e9"
checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4"
dependencies = [
"itoa",
"ryu",
@ -1879,7 +1879,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde",
"syn 2.0.46",
"syn 2.0.48",
]
[[package]]
@ -2051,9 +2051,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.46"
version = "2.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89456b690ff72fddcecf231caedbe615c59480c93358a93dfae7fc29e3ebbf0e"
checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f"
dependencies = [
"proc-macro2",
"quote",
@ -2122,22 +2122,22 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.51"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7"
checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.51"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df"
checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.48",
]
[[package]]
@ -2209,7 +2209,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.48",
]
[[package]]
@ -2359,7 +2359,7 @@ checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
[[package]]
name = "typify"
version = "0.0.15"
source = "git+https://github.com/oxidecomputer/typify#7ceddf6644356819d1c829deb7a160197c4d0493"
source = "git+https://github.com/oxidecomputer/typify#1d8e828f29636613f0d29349f9ae0e41a546b454"
dependencies = [
"typify-impl",
"typify-macro",
@ -2368,7 +2368,7 @@ dependencies = [
[[package]]
name = "typify-impl"
version = "0.0.15"
source = "git+https://github.com/oxidecomputer/typify#7ceddf6644356819d1c829deb7a160197c4d0493"
source = "git+https://github.com/oxidecomputer/typify#1d8e828f29636613f0d29349f9ae0e41a546b454"
dependencies = [
"heck",
"log",
@ -2377,7 +2377,7 @@ dependencies = [
"regress",
"schemars",
"serde_json",
"syn 2.0.46",
"syn 2.0.48",
"thiserror",
"unicode-ident",
]
@ -2385,7 +2385,7 @@ dependencies = [
[[package]]
name = "typify-macro"
version = "0.0.15"
source = "git+https://github.com/oxidecomputer/typify#7ceddf6644356819d1c829deb7a160197c4d0493"
source = "git+https://github.com/oxidecomputer/typify#1d8e828f29636613f0d29349f9ae0e41a546b454"
dependencies = [
"proc-macro2",
"quote",
@ -2393,7 +2393,7 @@ dependencies = [
"serde",
"serde_json",
"serde_tokenstream",
"syn 2.0.46",
"syn 2.0.48",
"typify-impl",
]
@ -2546,7 +2546,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.48",
"wasm-bindgen-shared",
]
@ -2580,7 +2580,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.48",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -2613,7 +2613,7 @@ checksum = "794645f5408c9a039fd09f4d113cdfb2e7eba5ff1956b07bcf701cf4b394fe89"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.48",
]
[[package]]

View File

@ -8,6 +8,36 @@ pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
/// Error types.
pub mod error {
/// Error from a TryFrom or FromStr implementation.
pub struct ConversionError(std::borrow::Cow<'static, str>);
impl std::error::Error for ConversionError {}
impl std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Display::fmt(&self.0, f)
}
}
impl std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///Task
///
/// <details><summary>JSON schema</summary>
@ -844,6 +874,7 @@ pub mod types {
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct Task {
@ -920,8 +951,8 @@ pub mod types {
}
impl std::convert::TryFrom<Task> for super::Task {
type Error = String;
fn try_from(value: Task) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: Task) -> Result<Self, super::error::ConversionError> {
Ok(Self {
id: value.id?,
name: value.name?,
@ -1007,8 +1038,8 @@ pub mod types {
}
impl std::convert::TryFrom<TaskEvent> for super::TaskEvent {
type Error = String;
fn try_from(value: TaskEvent) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: TaskEvent) -> Result<Self, super::error::ConversionError> {
Ok(Self {
payload: value.payload?,
seq: value.seq?,
@ -1080,8 +1111,8 @@ pub mod types {
}
impl std::convert::TryFrom<TaskOutput> for super::TaskOutput {
type Error = String;
fn try_from(value: TaskOutput) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: TaskOutput) -> Result<Self, super::error::ConversionError> {
Ok(Self {
id: value.id?,
path: value.path?,
@ -1151,8 +1182,8 @@ pub mod types {
}
impl std::convert::TryFrom<TaskSubmit> for super::TaskSubmit {
type Error = String;
fn try_from(value: TaskSubmit) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: TaskSubmit) -> Result<Self, super::error::ConversionError> {
Ok(Self {
name: value.name?,
output_rules: value.output_rules?,
@ -1198,8 +1229,8 @@ pub mod types {
}
impl std::convert::TryFrom<TaskSubmitResult> for super::TaskSubmitResult {
type Error = String;
fn try_from(value: TaskSubmitResult) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: TaskSubmitResult) -> Result<Self, super::error::ConversionError> {
Ok(Self { id: value.id? })
}
}
@ -1237,8 +1268,8 @@ pub mod types {
}
impl std::convert::TryFrom<UploadedChunk> for super::UploadedChunk {
type Error = String;
fn try_from(value: UploadedChunk) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: UploadedChunk) -> Result<Self, super::error::ConversionError> {
Ok(Self { id: value.id? })
}
}
@ -1276,8 +1307,8 @@ pub mod types {
}
impl std::convert::TryFrom<UserCreate> for super::UserCreate {
type Error = String;
fn try_from(value: UserCreate) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: UserCreate) -> Result<Self, super::error::ConversionError> {
Ok(Self { name: value.name? })
}
}
@ -1341,8 +1372,8 @@ pub mod types {
}
impl std::convert::TryFrom<UserCreateResult> for super::UserCreateResult {
type Error = String;
fn try_from(value: UserCreateResult) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: UserCreateResult) -> Result<Self, super::error::ConversionError> {
Ok(Self {
id: value.id?,
name: value.name?,
@ -1400,8 +1431,8 @@ pub mod types {
}
impl std::convert::TryFrom<WhoamiResult> for super::WhoamiResult {
type Error = String;
fn try_from(value: WhoamiResult) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: WhoamiResult) -> Result<Self, super::error::ConversionError> {
Ok(Self {
id: value.id?,
name: value.name?,
@ -1505,8 +1536,8 @@ pub mod types {
}
impl std::convert::TryFrom<Worker> for super::Worker {
type Error = String;
fn try_from(value: Worker) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: Worker) -> Result<Self, super::error::ConversionError> {
Ok(Self {
deleted: value.deleted?,
id: value.id?,
@ -1582,8 +1613,8 @@ pub mod types {
}
impl std::convert::TryFrom<WorkerAddOutput> for super::WorkerAddOutput {
type Error = String;
fn try_from(value: WorkerAddOutput) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: WorkerAddOutput) -> Result<Self, super::error::ConversionError> {
Ok(Self {
chunks: value.chunks?,
path: value.path?,
@ -1653,8 +1684,8 @@ pub mod types {
}
impl std::convert::TryFrom<WorkerAppendTask> for super::WorkerAppendTask {
type Error = String;
fn try_from(value: WorkerAppendTask) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: WorkerAppendTask) -> Result<Self, super::error::ConversionError> {
Ok(Self {
payload: value.payload?,
stream: value.stream?,
@ -1712,8 +1743,8 @@ pub mod types {
}
impl std::convert::TryFrom<WorkerBootstrap> for super::WorkerBootstrap {
type Error = String;
fn try_from(value: WorkerBootstrap) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: WorkerBootstrap) -> Result<Self, super::error::ConversionError> {
Ok(Self {
bootstrap: value.bootstrap?,
token: value.token?,
@ -1757,8 +1788,10 @@ pub mod types {
}
impl std::convert::TryFrom<WorkerBootstrapResult> for super::WorkerBootstrapResult {
type Error = String;
fn try_from(value: WorkerBootstrapResult) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: WorkerBootstrapResult,
) -> Result<Self, super::error::ConversionError> {
Ok(Self { id: value.id? })
}
}
@ -1796,8 +1829,8 @@ pub mod types {
}
impl std::convert::TryFrom<WorkerCompleteTask> for super::WorkerCompleteTask {
type Error = String;
fn try_from(value: WorkerCompleteTask) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: WorkerCompleteTask) -> Result<Self, super::error::ConversionError> {
Ok(Self {
failed: value.failed?,
})
@ -1851,8 +1884,8 @@ pub mod types {
}
impl std::convert::TryFrom<WorkerPingResult> for super::WorkerPingResult {
type Error = String;
fn try_from(value: WorkerPingResult) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: WorkerPingResult) -> Result<Self, super::error::ConversionError> {
Ok(Self {
poweroff: value.poweroff?,
task: value.task?,
@ -1920,8 +1953,8 @@ pub mod types {
}
impl std::convert::TryFrom<WorkerPingTask> for super::WorkerPingTask {
type Error = String;
fn try_from(value: WorkerPingTask) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: WorkerPingTask) -> Result<Self, super::error::ConversionError> {
Ok(Self {
id: value.id?,
output_rules: value.output_rules?,
@ -1991,8 +2024,8 @@ pub mod types {
}
impl std::convert::TryFrom<WorkerTask> for super::WorkerTask {
type Error = String;
fn try_from(value: WorkerTask) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: WorkerTask) -> Result<Self, super::error::ConversionError> {
Ok(Self {
id: value.id?,
name: value.name?,
@ -2038,8 +2071,8 @@ pub mod types {
}
impl std::convert::TryFrom<WorkersResult> for super::WorkersResult {
type Error = String;
fn try_from(value: WorkersResult) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: WorkersResult) -> Result<Self, super::error::ConversionError> {
Ok(Self {
workers: value.workers?,
})

View File

@ -8,6 +8,36 @@ pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
/// Error types.
pub mod error {
/// Error from a TryFrom or FromStr implementation.
pub struct ConversionError(std::borrow::Cow<'static, str>);
impl std::error::Error for ConversionError {}
impl std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Display::fmt(&self.0, f)
}
}
impl std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///Task
///
/// <details><summary>JSON schema</summary>
@ -844,6 +874,7 @@ pub mod types {
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct Task {
@ -920,8 +951,8 @@ pub mod types {
}
impl std::convert::TryFrom<Task> for super::Task {
type Error = String;
fn try_from(value: Task) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: Task) -> Result<Self, super::error::ConversionError> {
Ok(Self {
id: value.id?,
name: value.name?,
@ -1007,8 +1038,8 @@ pub mod types {
}
impl std::convert::TryFrom<TaskEvent> for super::TaskEvent {
type Error = String;
fn try_from(value: TaskEvent) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: TaskEvent) -> Result<Self, super::error::ConversionError> {
Ok(Self {
payload: value.payload?,
seq: value.seq?,
@ -1080,8 +1111,8 @@ pub mod types {
}
impl std::convert::TryFrom<TaskOutput> for super::TaskOutput {
type Error = String;
fn try_from(value: TaskOutput) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: TaskOutput) -> Result<Self, super::error::ConversionError> {
Ok(Self {
id: value.id?,
path: value.path?,
@ -1151,8 +1182,8 @@ pub mod types {
}
impl std::convert::TryFrom<TaskSubmit> for super::TaskSubmit {
type Error = String;
fn try_from(value: TaskSubmit) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: TaskSubmit) -> Result<Self, super::error::ConversionError> {
Ok(Self {
name: value.name?,
output_rules: value.output_rules?,
@ -1198,8 +1229,8 @@ pub mod types {
}
impl std::convert::TryFrom<TaskSubmitResult> for super::TaskSubmitResult {
type Error = String;
fn try_from(value: TaskSubmitResult) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: TaskSubmitResult) -> Result<Self, super::error::ConversionError> {
Ok(Self { id: value.id? })
}
}
@ -1237,8 +1268,8 @@ pub mod types {
}
impl std::convert::TryFrom<UploadedChunk> for super::UploadedChunk {
type Error = String;
fn try_from(value: UploadedChunk) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: UploadedChunk) -> Result<Self, super::error::ConversionError> {
Ok(Self { id: value.id? })
}
}
@ -1276,8 +1307,8 @@ pub mod types {
}
impl std::convert::TryFrom<UserCreate> for super::UserCreate {
type Error = String;
fn try_from(value: UserCreate) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: UserCreate) -> Result<Self, super::error::ConversionError> {
Ok(Self { name: value.name? })
}
}
@ -1341,8 +1372,8 @@ pub mod types {
}
impl std::convert::TryFrom<UserCreateResult> for super::UserCreateResult {
type Error = String;
fn try_from(value: UserCreateResult) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: UserCreateResult) -> Result<Self, super::error::ConversionError> {
Ok(Self {
id: value.id?,
name: value.name?,
@ -1400,8 +1431,8 @@ pub mod types {
}
impl std::convert::TryFrom<WhoamiResult> for super::WhoamiResult {
type Error = String;
fn try_from(value: WhoamiResult) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: WhoamiResult) -> Result<Self, super::error::ConversionError> {
Ok(Self {
id: value.id?,
name: value.name?,
@ -1505,8 +1536,8 @@ pub mod types {
}
impl std::convert::TryFrom<Worker> for super::Worker {
type Error = String;
fn try_from(value: Worker) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: Worker) -> Result<Self, super::error::ConversionError> {
Ok(Self {
deleted: value.deleted?,
id: value.id?,
@ -1582,8 +1613,8 @@ pub mod types {
}
impl std::convert::TryFrom<WorkerAddOutput> for super::WorkerAddOutput {
type Error = String;
fn try_from(value: WorkerAddOutput) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: WorkerAddOutput) -> Result<Self, super::error::ConversionError> {
Ok(Self {
chunks: value.chunks?,
path: value.path?,
@ -1653,8 +1684,8 @@ pub mod types {
}
impl std::convert::TryFrom<WorkerAppendTask> for super::WorkerAppendTask {
type Error = String;
fn try_from(value: WorkerAppendTask) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: WorkerAppendTask) -> Result<Self, super::error::ConversionError> {
Ok(Self {
payload: value.payload?,
stream: value.stream?,
@ -1712,8 +1743,8 @@ pub mod types {
}
impl std::convert::TryFrom<WorkerBootstrap> for super::WorkerBootstrap {
type Error = String;
fn try_from(value: WorkerBootstrap) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: WorkerBootstrap) -> Result<Self, super::error::ConversionError> {
Ok(Self {
bootstrap: value.bootstrap?,
token: value.token?,
@ -1757,8 +1788,10 @@ pub mod types {
}
impl std::convert::TryFrom<WorkerBootstrapResult> for super::WorkerBootstrapResult {
type Error = String;
fn try_from(value: WorkerBootstrapResult) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: WorkerBootstrapResult,
) -> Result<Self, super::error::ConversionError> {
Ok(Self { id: value.id? })
}
}
@ -1796,8 +1829,8 @@ pub mod types {
}
impl std::convert::TryFrom<WorkerCompleteTask> for super::WorkerCompleteTask {
type Error = String;
fn try_from(value: WorkerCompleteTask) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: WorkerCompleteTask) -> Result<Self, super::error::ConversionError> {
Ok(Self {
failed: value.failed?,
})
@ -1851,8 +1884,8 @@ pub mod types {
}
impl std::convert::TryFrom<WorkerPingResult> for super::WorkerPingResult {
type Error = String;
fn try_from(value: WorkerPingResult) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: WorkerPingResult) -> Result<Self, super::error::ConversionError> {
Ok(Self {
poweroff: value.poweroff?,
task: value.task?,
@ -1920,8 +1953,8 @@ pub mod types {
}
impl std::convert::TryFrom<WorkerPingTask> for super::WorkerPingTask {
type Error = String;
fn try_from(value: WorkerPingTask) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: WorkerPingTask) -> Result<Self, super::error::ConversionError> {
Ok(Self {
id: value.id?,
output_rules: value.output_rules?,
@ -1991,8 +2024,8 @@ pub mod types {
}
impl std::convert::TryFrom<WorkerTask> for super::WorkerTask {
type Error = String;
fn try_from(value: WorkerTask) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: WorkerTask) -> Result<Self, super::error::ConversionError> {
Ok(Self {
id: value.id?,
name: value.name?,
@ -2038,8 +2071,8 @@ pub mod types {
}
impl std::convert::TryFrom<WorkersResult> for super::WorkersResult {
type Error = String;
fn try_from(value: WorkersResult) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: WorkersResult) -> Result<Self, super::error::ConversionError> {
Ok(Self {
workers: value.workers?,
})

View File

@ -8,6 +8,36 @@ pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
/// Error types.
pub mod error {
/// Error from a TryFrom or FromStr implementation.
pub struct ConversionError(std::borrow::Cow<'static, str>);
impl std::error::Error for ConversionError {}
impl std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Display::fmt(&self.0, f)
}
}
impl std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///Task
///
/// <details><summary>JSON schema</summary>

View File

@ -8,6 +8,36 @@ pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
/// Error types.
pub mod error {
/// Error from a TryFrom or FromStr implementation.
pub struct ConversionError(std::borrow::Cow<'static, str>);
impl std::error::Error for ConversionError {}
impl std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Display::fmt(&self.0, f)
}
}
impl std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///EnrolBody
///
/// <details><summary>JSON schema</summary>
@ -475,6 +505,7 @@ pub mod types {
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct EnrolBody {
@ -515,8 +546,8 @@ pub mod types {
}
impl std::convert::TryFrom<EnrolBody> for super::EnrolBody {
type Error = String;
fn try_from(value: EnrolBody) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: EnrolBody) -> Result<Self, super::error::ConversionError> {
Ok(Self {
host: value.host?,
key: value.key?,
@ -560,8 +591,8 @@ pub mod types {
}
impl std::convert::TryFrom<GlobalJobsResult> for super::GlobalJobsResult {
type Error = String;
fn try_from(value: GlobalJobsResult) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: GlobalJobsResult) -> Result<Self, super::error::ConversionError> {
Ok(Self {
summary: value.summary?,
})
@ -627,8 +658,8 @@ pub mod types {
}
impl std::convert::TryFrom<OutputRecord> for super::OutputRecord {
type Error = String;
fn try_from(value: OutputRecord) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: OutputRecord) -> Result<Self, super::error::ConversionError> {
Ok(Self {
msg: value.msg?,
stream: value.stream?,
@ -686,8 +717,8 @@ pub mod types {
}
impl std::convert::TryFrom<PingResult> for super::PingResult {
type Error = String;
fn try_from(value: PingResult) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: PingResult) -> Result<Self, super::error::ConversionError> {
Ok(Self {
host: value.host?,
ok: value.ok?,
@ -767,8 +798,8 @@ pub mod types {
}
impl std::convert::TryFrom<ReportFinishBody> for super::ReportFinishBody {
type Error = String;
fn try_from(value: ReportFinishBody) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: ReportFinishBody) -> Result<Self, super::error::ConversionError> {
Ok(Self {
duration_millis: value.duration_millis?,
end_time: value.end_time?,
@ -864,8 +895,8 @@ pub mod types {
}
impl std::convert::TryFrom<ReportId> for super::ReportId {
type Error = String;
fn try_from(value: ReportId) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: ReportId) -> Result<Self, super::error::ConversionError> {
Ok(Self {
host: value.host?,
job: value.job?,
@ -927,8 +958,8 @@ pub mod types {
}
impl std::convert::TryFrom<ReportOutputBody> for super::ReportOutputBody {
type Error = String;
fn try_from(value: ReportOutputBody) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: ReportOutputBody) -> Result<Self, super::error::ConversionError> {
Ok(Self {
id: value.id?,
record: value.record?,
@ -972,8 +1003,8 @@ pub mod types {
}
impl std::convert::TryFrom<ReportResult> for super::ReportResult {
type Error = String;
fn try_from(value: ReportResult) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: ReportResult) -> Result<Self, super::error::ConversionError> {
Ok(Self {
existed_already: value.existed_already?,
})
@ -1039,8 +1070,8 @@ pub mod types {
}
impl std::convert::TryFrom<ReportStartBody> for super::ReportStartBody {
type Error = String;
fn try_from(value: ReportStartBody) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: ReportStartBody) -> Result<Self, super::error::ConversionError> {
Ok(Self {
id: value.id?,
script: value.script?,
@ -1149,8 +1180,8 @@ pub mod types {
}
impl std::convert::TryFrom<ReportSummary> for super::ReportSummary {
type Error = String;
fn try_from(value: ReportSummary) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: ReportSummary) -> Result<Self, super::error::ConversionError> {
Ok(Self {
age_seconds: value.age_seconds?,
duration_seconds: value.duration_seconds?,

View File

@ -8,6 +8,36 @@ pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
/// Error types.
pub mod error {
/// Error from a TryFrom or FromStr implementation.
pub struct ConversionError(std::borrow::Cow<'static, str>);
impl std::error::Error for ConversionError {}
impl std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Display::fmt(&self.0, f)
}
}
impl std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///EnrolBody
///
/// <details><summary>JSON schema</summary>
@ -475,6 +505,7 @@ pub mod types {
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct EnrolBody {
@ -515,8 +546,8 @@ pub mod types {
}
impl std::convert::TryFrom<EnrolBody> for super::EnrolBody {
type Error = String;
fn try_from(value: EnrolBody) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: EnrolBody) -> Result<Self, super::error::ConversionError> {
Ok(Self {
host: value.host?,
key: value.key?,
@ -560,8 +591,8 @@ pub mod types {
}
impl std::convert::TryFrom<GlobalJobsResult> for super::GlobalJobsResult {
type Error = String;
fn try_from(value: GlobalJobsResult) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: GlobalJobsResult) -> Result<Self, super::error::ConversionError> {
Ok(Self {
summary: value.summary?,
})
@ -627,8 +658,8 @@ pub mod types {
}
impl std::convert::TryFrom<OutputRecord> for super::OutputRecord {
type Error = String;
fn try_from(value: OutputRecord) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: OutputRecord) -> Result<Self, super::error::ConversionError> {
Ok(Self {
msg: value.msg?,
stream: value.stream?,
@ -686,8 +717,8 @@ pub mod types {
}
impl std::convert::TryFrom<PingResult> for super::PingResult {
type Error = String;
fn try_from(value: PingResult) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: PingResult) -> Result<Self, super::error::ConversionError> {
Ok(Self {
host: value.host?,
ok: value.ok?,
@ -767,8 +798,8 @@ pub mod types {
}
impl std::convert::TryFrom<ReportFinishBody> for super::ReportFinishBody {
type Error = String;
fn try_from(value: ReportFinishBody) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: ReportFinishBody) -> Result<Self, super::error::ConversionError> {
Ok(Self {
duration_millis: value.duration_millis?,
end_time: value.end_time?,
@ -864,8 +895,8 @@ pub mod types {
}
impl std::convert::TryFrom<ReportId> for super::ReportId {
type Error = String;
fn try_from(value: ReportId) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: ReportId) -> Result<Self, super::error::ConversionError> {
Ok(Self {
host: value.host?,
job: value.job?,
@ -927,8 +958,8 @@ pub mod types {
}
impl std::convert::TryFrom<ReportOutputBody> for super::ReportOutputBody {
type Error = String;
fn try_from(value: ReportOutputBody) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: ReportOutputBody) -> Result<Self, super::error::ConversionError> {
Ok(Self {
id: value.id?,
record: value.record?,
@ -972,8 +1003,8 @@ pub mod types {
}
impl std::convert::TryFrom<ReportResult> for super::ReportResult {
type Error = String;
fn try_from(value: ReportResult) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: ReportResult) -> Result<Self, super::error::ConversionError> {
Ok(Self {
existed_already: value.existed_already?,
})
@ -1039,8 +1070,8 @@ pub mod types {
}
impl std::convert::TryFrom<ReportStartBody> for super::ReportStartBody {
type Error = String;
fn try_from(value: ReportStartBody) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: ReportStartBody) -> Result<Self, super::error::ConversionError> {
Ok(Self {
id: value.id?,
script: value.script?,
@ -1149,8 +1180,8 @@ pub mod types {
}
impl std::convert::TryFrom<ReportSummary> for super::ReportSummary {
type Error = String;
fn try_from(value: ReportSummary) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: ReportSummary) -> Result<Self, super::error::ConversionError> {
Ok(Self {
age_seconds: value.age_seconds?,
duration_seconds: value.duration_seconds?,

View File

@ -8,6 +8,36 @@ pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
/// Error types.
pub mod error {
/// Error from a TryFrom or FromStr implementation.
pub struct ConversionError(std::borrow::Cow<'static, str>);
impl std::error::Error for ConversionError {}
impl std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Display::fmt(&self.0, f)
}
}
impl std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///EnrolBody
///
/// <details><summary>JSON schema</summary>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,35 @@ pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
/// Error types.
pub mod error {
/// Error from a TryFrom or FromStr implementation.
pub struct ConversionError(std::borrow::Cow<'static, str>);
impl std::error::Error for ConversionError {}
impl std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Display::fmt(&self.0, f)
}
}
impl std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
}
#[derive(Clone, Debug)]

View File

@ -8,6 +8,35 @@ pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
/// Error types.
pub mod error {
/// Error from a TryFrom or FromStr implementation.
pub struct ConversionError(std::borrow::Cow<'static, str>);
impl std::error::Error for ConversionError {}
impl std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Display::fmt(&self.0, f)
}
}
impl std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
}
#[derive(Clone, Debug)]

View File

@ -8,6 +8,35 @@ pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
/// Error types.
pub mod error {
/// Error from a TryFrom or FromStr implementation.
pub struct ConversionError(std::borrow::Cow<'static, str>);
impl std::error::Error for ConversionError {}
impl std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Display::fmt(&self.0, f)
}
}
impl std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
}
#[derive(Clone, Debug)]

View File

@ -8,6 +8,35 @@ pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
/// Error types.
pub mod error {
/// Error from a TryFrom or FromStr implementation.
pub struct ConversionError(std::borrow::Cow<'static, str>);
impl std::error::Error for ConversionError {}
impl std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Display::fmt(&self.0, f)
}
}
impl std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
}
#[derive(Clone, Debug)]

View File

@ -8,6 +8,35 @@ pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
/// Error types.
pub mod error {
/// Error from a TryFrom or FromStr implementation.
pub struct ConversionError(std::borrow::Cow<'static, str>);
impl std::error::Error for ConversionError {}
impl std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Display::fmt(&self.0, f)
}
}
impl std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
}
#[derive(Clone, Debug)]

View File

@ -8,6 +8,35 @@ pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
/// Error types.
pub mod error {
/// Error from a TryFrom or FromStr implementation.
pub struct ConversionError(std::borrow::Cow<'static, str>);
impl std::error::Error for ConversionError {}
impl std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Display::fmt(&self.0, f)
}
}
impl std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
}
#[derive(Clone, Debug)]

View File

@ -8,6 +8,36 @@ pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
/// Error types.
pub mod error {
/// Error from a TryFrom or FromStr implementation.
pub struct ConversionError(std::borrow::Cow<'static, str>);
impl std::error::Error for ConversionError {}
impl std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Display::fmt(&self.0, f)
}
}
impl std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///CrucibleOpts
///
/// <details><summary>JSON schema</summary>
@ -832,8 +862,8 @@ pub mod types {
}
impl std::str::FromStr for InstanceState {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, &'static str> {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> Result<Self, self::error::ConversionError> {
match value {
"Creating" => Ok(Self::Creating),
"Starting" => Ok(Self::Starting),
@ -845,28 +875,28 @@ pub mod types {
"Repairing" => Ok(Self::Repairing),
"Failed" => Ok(Self::Failed),
"Destroyed" => Ok(Self::Destroyed),
_ => Err("invalid value"),
_ => Err("invalid value".into()),
}
}
}
impl std::convert::TryFrom<&str> for InstanceState {
type Error = &'static str;
fn try_from(value: &str) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl std::convert::TryFrom<&String> for InstanceState {
type Error = &'static str;
fn try_from(value: &String) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: &String) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl std::convert::TryFrom<String> for InstanceState {
type Error = &'static str;
fn try_from(value: String) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: String) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
@ -1004,35 +1034,35 @@ pub mod types {
}
impl std::str::FromStr for InstanceStateRequested {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, &'static str> {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> Result<Self, self::error::ConversionError> {
match value {
"Run" => Ok(Self::Run),
"Stop" => Ok(Self::Stop),
"Reboot" => Ok(Self::Reboot),
"MigrateStart" => Ok(Self::MigrateStart),
_ => Err("invalid value"),
_ => Err("invalid value".into()),
}
}
}
impl std::convert::TryFrom<&str> for InstanceStateRequested {
type Error = &'static str;
fn try_from(value: &str) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl std::convert::TryFrom<&String> for InstanceStateRequested {
type Error = &'static str;
fn try_from(value: &String) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: &String) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl std::convert::TryFrom<String> for InstanceStateRequested {
type Error = &'static str;
fn try_from(value: String) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: String) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
@ -1109,8 +1139,8 @@ pub mod types {
}
impl std::str::FromStr for MigrationState {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, &'static str> {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> Result<Self, self::error::ConversionError> {
match value {
"Sync" => Ok(Self::Sync),
"RamPush" => Ok(Self::RamPush),
@ -1122,28 +1152,28 @@ pub mod types {
"RamPull" => Ok(Self::RamPull),
"Finish" => Ok(Self::Finish),
"Error" => Ok(Self::Error),
_ => Err("invalid value"),
_ => Err("invalid value".into()),
}
}
}
impl std::convert::TryFrom<&str> for MigrationState {
type Error = &'static str;
fn try_from(value: &str) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl std::convert::TryFrom<&String> for MigrationState {
type Error = &'static str;
fn try_from(value: &String) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: &String) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl std::convert::TryFrom<String> for MigrationState {
type Error = &'static str;
fn try_from(value: String) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: String) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
@ -1528,6 +1558,7 @@ pub mod types {
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct CrucibleOpts {
@ -1664,8 +1695,8 @@ pub mod types {
}
impl std::convert::TryFrom<CrucibleOpts> for super::CrucibleOpts {
type Error = String;
fn try_from(value: CrucibleOpts) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: CrucibleOpts) -> Result<Self, super::error::ConversionError> {
Ok(Self {
cert_pem: value.cert_pem?,
control: value.control?,
@ -1749,8 +1780,8 @@ pub mod types {
}
impl std::convert::TryFrom<DiskAttachment> for super::DiskAttachment {
type Error = String;
fn try_from(value: DiskAttachment) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: DiskAttachment) -> Result<Self, super::error::ConversionError> {
Ok(Self {
disk_id: value.disk_id?,
generation_id: value.generation_id?,
@ -1861,8 +1892,8 @@ pub mod types {
}
impl std::convert::TryFrom<DiskRequest> for super::DiskRequest {
type Error = String;
fn try_from(value: DiskRequest) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: DiskRequest) -> Result<Self, super::error::ConversionError> {
Ok(Self {
device: value.device?,
gen: value.gen?,
@ -1938,8 +1969,8 @@ pub mod types {
}
impl std::convert::TryFrom<Error> for super::Error {
type Error = String;
fn try_from(value: Error) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: Error) -> Result<Self, super::error::ConversionError> {
Ok(Self {
error_code: value.error_code?,
message: value.message?,
@ -2021,8 +2052,8 @@ pub mod types {
}
impl std::convert::TryFrom<Instance> for super::Instance {
type Error = String;
fn try_from(value: Instance) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: Instance) -> Result<Self, super::error::ConversionError> {
Ok(Self {
disks: value.disks?,
nics: value.nics?,
@ -2121,8 +2152,10 @@ pub mod types {
}
impl std::convert::TryFrom<InstanceEnsureRequest> for super::InstanceEnsureRequest {
type Error = String;
fn try_from(value: InstanceEnsureRequest) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: InstanceEnsureRequest,
) -> Result<Self, super::error::ConversionError> {
Ok(Self {
cloud_init_bytes: value.cloud_init_bytes?,
disks: value.disks?,
@ -2172,8 +2205,10 @@ pub mod types {
}
impl std::convert::TryFrom<InstanceEnsureResponse> for super::InstanceEnsureResponse {
type Error = String;
fn try_from(value: InstanceEnsureResponse) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: InstanceEnsureResponse,
) -> Result<Self, super::error::ConversionError> {
Ok(Self {
migrate: value.migrate?,
})
@ -2215,8 +2250,8 @@ pub mod types {
}
impl std::convert::TryFrom<InstanceGetResponse> for super::InstanceGetResponse {
type Error = String;
fn try_from(value: InstanceGetResponse) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: InstanceGetResponse) -> Result<Self, super::error::ConversionError> {
Ok(Self {
instance: value.instance?,
})
@ -2284,8 +2319,10 @@ pub mod types {
impl std::convert::TryFrom<InstanceMigrateInitiateRequest>
for super::InstanceMigrateInitiateRequest
{
type Error = String;
fn try_from(value: InstanceMigrateInitiateRequest) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: InstanceMigrateInitiateRequest,
) -> Result<Self, super::error::ConversionError> {
Ok(Self {
migration_id: value.migration_id?,
src_addr: value.src_addr?,
@ -2333,8 +2370,10 @@ pub mod types {
impl std::convert::TryFrom<InstanceMigrateInitiateResponse>
for super::InstanceMigrateInitiateResponse
{
type Error = String;
fn try_from(value: InstanceMigrateInitiateResponse) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: InstanceMigrateInitiateResponse,
) -> Result<Self, super::error::ConversionError> {
Ok(Self {
migration_id: value.migration_id?,
})
@ -2376,8 +2415,10 @@ pub mod types {
}
impl std::convert::TryFrom<InstanceMigrateStatusRequest> for super::InstanceMigrateStatusRequest {
type Error = String;
fn try_from(value: InstanceMigrateStatusRequest) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: InstanceMigrateStatusRequest,
) -> Result<Self, super::error::ConversionError> {
Ok(Self {
migration_id: value.migration_id?,
})
@ -2419,8 +2460,10 @@ pub mod types {
}
impl std::convert::TryFrom<InstanceMigrateStatusResponse> for super::InstanceMigrateStatusResponse {
type Error = String;
fn try_from(value: InstanceMigrateStatusResponse) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: InstanceMigrateStatusResponse,
) -> Result<Self, super::error::ConversionError> {
Ok(Self {
state: value.state?,
})
@ -2534,8 +2577,8 @@ pub mod types {
}
impl std::convert::TryFrom<InstanceProperties> for super::InstanceProperties {
type Error = String;
fn try_from(value: InstanceProperties) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: InstanceProperties) -> Result<Self, super::error::ConversionError> {
Ok(Self {
bootrom_id: value.bootrom_id?,
description: value.description?,
@ -2589,8 +2632,10 @@ pub mod types {
}
impl std::convert::TryFrom<InstanceStateMonitorRequest> for super::InstanceStateMonitorRequest {
type Error = String;
fn try_from(value: InstanceStateMonitorRequest) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: InstanceStateMonitorRequest,
) -> Result<Self, super::error::ConversionError> {
Ok(Self { gen: value.gen? })
}
}
@ -2640,8 +2685,10 @@ pub mod types {
}
impl std::convert::TryFrom<InstanceStateMonitorResponse> for super::InstanceStateMonitorResponse {
type Error = String;
fn try_from(value: InstanceStateMonitorResponse) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: InstanceStateMonitorResponse,
) -> Result<Self, super::error::ConversionError> {
Ok(Self {
gen: value.gen?,
state: value.state?,
@ -2697,8 +2744,8 @@ pub mod types {
}
impl std::convert::TryFrom<NetworkInterface> for super::NetworkInterface {
type Error = String;
fn try_from(value: NetworkInterface) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: NetworkInterface) -> Result<Self, super::error::ConversionError> {
Ok(Self {
attachment: value.attachment?,
name: value.name?,
@ -2754,8 +2801,10 @@ pub mod types {
}
impl std::convert::TryFrom<NetworkInterfaceRequest> for super::NetworkInterfaceRequest {
type Error = String;
fn try_from(value: NetworkInterfaceRequest) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: NetworkInterfaceRequest,
) -> Result<Self, super::error::ConversionError> {
Ok(Self {
name: value.name?,
slot: value.slot?,

View File

@ -8,6 +8,36 @@ pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
/// Error types.
pub mod error {
/// Error from a TryFrom or FromStr implementation.
pub struct ConversionError(std::borrow::Cow<'static, str>);
impl std::error::Error for ConversionError {}
impl std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Display::fmt(&self.0, f)
}
}
impl std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///CrucibleOpts
///
/// <details><summary>JSON schema</summary>
@ -820,8 +850,8 @@ pub mod types {
}
impl std::str::FromStr for InstanceState {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, &'static str> {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> Result<Self, self::error::ConversionError> {
match value {
"Creating" => Ok(Self::Creating),
"Starting" => Ok(Self::Starting),
@ -833,28 +863,28 @@ pub mod types {
"Repairing" => Ok(Self::Repairing),
"Failed" => Ok(Self::Failed),
"Destroyed" => Ok(Self::Destroyed),
_ => Err("invalid value"),
_ => Err("invalid value".into()),
}
}
}
impl std::convert::TryFrom<&str> for InstanceState {
type Error = &'static str;
fn try_from(value: &str) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl std::convert::TryFrom<&String> for InstanceState {
type Error = &'static str;
fn try_from(value: &String) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: &String) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl std::convert::TryFrom<String> for InstanceState {
type Error = &'static str;
fn try_from(value: String) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: String) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
@ -980,35 +1010,35 @@ pub mod types {
}
impl std::str::FromStr for InstanceStateRequested {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, &'static str> {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> Result<Self, self::error::ConversionError> {
match value {
"Run" => Ok(Self::Run),
"Stop" => Ok(Self::Stop),
"Reboot" => Ok(Self::Reboot),
"MigrateStart" => Ok(Self::MigrateStart),
_ => Err("invalid value"),
_ => Err("invalid value".into()),
}
}
}
impl std::convert::TryFrom<&str> for InstanceStateRequested {
type Error = &'static str;
fn try_from(value: &str) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl std::convert::TryFrom<&String> for InstanceStateRequested {
type Error = &'static str;
fn try_from(value: &String) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: &String) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl std::convert::TryFrom<String> for InstanceStateRequested {
type Error = &'static str;
fn try_from(value: String) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: String) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
@ -1073,8 +1103,8 @@ pub mod types {
}
impl std::str::FromStr for MigrationState {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, &'static str> {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> Result<Self, self::error::ConversionError> {
match value {
"Sync" => Ok(Self::Sync),
"RamPush" => Ok(Self::RamPush),
@ -1086,28 +1116,28 @@ pub mod types {
"RamPull" => Ok(Self::RamPull),
"Finish" => Ok(Self::Finish),
"Error" => Ok(Self::Error),
_ => Err("invalid value"),
_ => Err("invalid value".into()),
}
}
}
impl std::convert::TryFrom<&str> for MigrationState {
type Error = &'static str;
fn try_from(value: &str) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl std::convert::TryFrom<&String> for MigrationState {
type Error = &'static str;
fn try_from(value: &String) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: &String) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl std::convert::TryFrom<String> for MigrationState {
type Error = &'static str;
fn try_from(value: String) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: String) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
@ -1492,6 +1522,7 @@ pub mod types {
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct CrucibleOpts {
@ -1628,8 +1659,8 @@ pub mod types {
}
impl std::convert::TryFrom<CrucibleOpts> for super::CrucibleOpts {
type Error = String;
fn try_from(value: CrucibleOpts) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: CrucibleOpts) -> Result<Self, super::error::ConversionError> {
Ok(Self {
cert_pem: value.cert_pem?,
control: value.control?,
@ -1713,8 +1744,8 @@ pub mod types {
}
impl std::convert::TryFrom<DiskAttachment> for super::DiskAttachment {
type Error = String;
fn try_from(value: DiskAttachment) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: DiskAttachment) -> Result<Self, super::error::ConversionError> {
Ok(Self {
disk_id: value.disk_id?,
generation_id: value.generation_id?,
@ -1825,8 +1856,8 @@ pub mod types {
}
impl std::convert::TryFrom<DiskRequest> for super::DiskRequest {
type Error = String;
fn try_from(value: DiskRequest) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: DiskRequest) -> Result<Self, super::error::ConversionError> {
Ok(Self {
device: value.device?,
gen: value.gen?,
@ -1902,8 +1933,8 @@ pub mod types {
}
impl std::convert::TryFrom<Error> for super::Error {
type Error = String;
fn try_from(value: Error) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: Error) -> Result<Self, super::error::ConversionError> {
Ok(Self {
error_code: value.error_code?,
message: value.message?,
@ -1985,8 +2016,8 @@ pub mod types {
}
impl std::convert::TryFrom<Instance> for super::Instance {
type Error = String;
fn try_from(value: Instance) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: Instance) -> Result<Self, super::error::ConversionError> {
Ok(Self {
disks: value.disks?,
nics: value.nics?,
@ -2085,8 +2116,10 @@ pub mod types {
}
impl std::convert::TryFrom<InstanceEnsureRequest> for super::InstanceEnsureRequest {
type Error = String;
fn try_from(value: InstanceEnsureRequest) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: InstanceEnsureRequest,
) -> Result<Self, super::error::ConversionError> {
Ok(Self {
cloud_init_bytes: value.cloud_init_bytes?,
disks: value.disks?,
@ -2136,8 +2169,10 @@ pub mod types {
}
impl std::convert::TryFrom<InstanceEnsureResponse> for super::InstanceEnsureResponse {
type Error = String;
fn try_from(value: InstanceEnsureResponse) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: InstanceEnsureResponse,
) -> Result<Self, super::error::ConversionError> {
Ok(Self {
migrate: value.migrate?,
})
@ -2179,8 +2214,8 @@ pub mod types {
}
impl std::convert::TryFrom<InstanceGetResponse> for super::InstanceGetResponse {
type Error = String;
fn try_from(value: InstanceGetResponse) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: InstanceGetResponse) -> Result<Self, super::error::ConversionError> {
Ok(Self {
instance: value.instance?,
})
@ -2248,8 +2283,10 @@ pub mod types {
impl std::convert::TryFrom<InstanceMigrateInitiateRequest>
for super::InstanceMigrateInitiateRequest
{
type Error = String;
fn try_from(value: InstanceMigrateInitiateRequest) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: InstanceMigrateInitiateRequest,
) -> Result<Self, super::error::ConversionError> {
Ok(Self {
migration_id: value.migration_id?,
src_addr: value.src_addr?,
@ -2297,8 +2334,10 @@ pub mod types {
impl std::convert::TryFrom<InstanceMigrateInitiateResponse>
for super::InstanceMigrateInitiateResponse
{
type Error = String;
fn try_from(value: InstanceMigrateInitiateResponse) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: InstanceMigrateInitiateResponse,
) -> Result<Self, super::error::ConversionError> {
Ok(Self {
migration_id: value.migration_id?,
})
@ -2340,8 +2379,10 @@ pub mod types {
}
impl std::convert::TryFrom<InstanceMigrateStatusRequest> for super::InstanceMigrateStatusRequest {
type Error = String;
fn try_from(value: InstanceMigrateStatusRequest) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: InstanceMigrateStatusRequest,
) -> Result<Self, super::error::ConversionError> {
Ok(Self {
migration_id: value.migration_id?,
})
@ -2383,8 +2424,10 @@ pub mod types {
}
impl std::convert::TryFrom<InstanceMigrateStatusResponse> for super::InstanceMigrateStatusResponse {
type Error = String;
fn try_from(value: InstanceMigrateStatusResponse) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: InstanceMigrateStatusResponse,
) -> Result<Self, super::error::ConversionError> {
Ok(Self {
state: value.state?,
})
@ -2498,8 +2541,8 @@ pub mod types {
}
impl std::convert::TryFrom<InstanceProperties> for super::InstanceProperties {
type Error = String;
fn try_from(value: InstanceProperties) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: InstanceProperties) -> Result<Self, super::error::ConversionError> {
Ok(Self {
bootrom_id: value.bootrom_id?,
description: value.description?,
@ -2553,8 +2596,10 @@ pub mod types {
}
impl std::convert::TryFrom<InstanceStateMonitorRequest> for super::InstanceStateMonitorRequest {
type Error = String;
fn try_from(value: InstanceStateMonitorRequest) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: InstanceStateMonitorRequest,
) -> Result<Self, super::error::ConversionError> {
Ok(Self { gen: value.gen? })
}
}
@ -2604,8 +2649,10 @@ pub mod types {
}
impl std::convert::TryFrom<InstanceStateMonitorResponse> for super::InstanceStateMonitorResponse {
type Error = String;
fn try_from(value: InstanceStateMonitorResponse) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: InstanceStateMonitorResponse,
) -> Result<Self, super::error::ConversionError> {
Ok(Self {
gen: value.gen?,
state: value.state?,
@ -2661,8 +2708,8 @@ pub mod types {
}
impl std::convert::TryFrom<NetworkInterface> for super::NetworkInterface {
type Error = String;
fn try_from(value: NetworkInterface) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: NetworkInterface) -> Result<Self, super::error::ConversionError> {
Ok(Self {
attachment: value.attachment?,
name: value.name?,
@ -2718,8 +2765,10 @@ pub mod types {
}
impl std::convert::TryFrom<NetworkInterfaceRequest> for super::NetworkInterfaceRequest {
type Error = String;
fn try_from(value: NetworkInterfaceRequest) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(
value: NetworkInterfaceRequest,
) -> Result<Self, super::error::ConversionError> {
Ok(Self {
name: value.name?,
slot: value.slot?,

View File

@ -8,6 +8,36 @@ pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
/// Error types.
pub mod error {
/// Error from a TryFrom or FromStr implementation.
pub struct ConversionError(std::borrow::Cow<'static, str>);
impl std::error::Error for ConversionError {}
impl std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Display::fmt(&self.0, f)
}
}
impl std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///CrucibleOpts
///
/// <details><summary>JSON schema</summary>
@ -742,8 +772,8 @@ pub mod types {
}
impl std::str::FromStr for InstanceState {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, &'static str> {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> Result<Self, self::error::ConversionError> {
match value {
"Creating" => Ok(Self::Creating),
"Starting" => Ok(Self::Starting),
@ -755,28 +785,28 @@ pub mod types {
"Repairing" => Ok(Self::Repairing),
"Failed" => Ok(Self::Failed),
"Destroyed" => Ok(Self::Destroyed),
_ => Err("invalid value"),
_ => Err("invalid value".into()),
}
}
}
impl std::convert::TryFrom<&str> for InstanceState {
type Error = &'static str;
fn try_from(value: &str) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl std::convert::TryFrom<&String> for InstanceState {
type Error = &'static str;
fn try_from(value: &String) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: &String) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl std::convert::TryFrom<String> for InstanceState {
type Error = &'static str;
fn try_from(value: String) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: String) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
@ -890,35 +920,35 @@ pub mod types {
}
impl std::str::FromStr for InstanceStateRequested {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, &'static str> {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> Result<Self, self::error::ConversionError> {
match value {
"Run" => Ok(Self::Run),
"Stop" => Ok(Self::Stop),
"Reboot" => Ok(Self::Reboot),
"MigrateStart" => Ok(Self::MigrateStart),
_ => Err("invalid value"),
_ => Err("invalid value".into()),
}
}
}
impl std::convert::TryFrom<&str> for InstanceStateRequested {
type Error = &'static str;
fn try_from(value: &str) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl std::convert::TryFrom<&String> for InstanceStateRequested {
type Error = &'static str;
fn try_from(value: &String) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: &String) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl std::convert::TryFrom<String> for InstanceStateRequested {
type Error = &'static str;
fn try_from(value: String) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: String) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
@ -983,8 +1013,8 @@ pub mod types {
}
impl std::str::FromStr for MigrationState {
type Err = &'static str;
fn from_str(value: &str) -> Result<Self, &'static str> {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> Result<Self, self::error::ConversionError> {
match value {
"Sync" => Ok(Self::Sync),
"RamPush" => Ok(Self::RamPush),
@ -996,28 +1026,28 @@ pub mod types {
"RamPull" => Ok(Self::RamPull),
"Finish" => Ok(Self::Finish),
"Error" => Ok(Self::Error),
_ => Err("invalid value"),
_ => Err("invalid value".into()),
}
}
}
impl std::convert::TryFrom<&str> for MigrationState {
type Error = &'static str;
fn try_from(value: &str) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl std::convert::TryFrom<&String> for MigrationState {
type Error = &'static str;
fn try_from(value: &String) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: &String) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl std::convert::TryFrom<String> for MigrationState {
type Error = &'static str;
fn try_from(value: String) -> Result<Self, &'static str> {
type Error = self::error::ConversionError;
fn try_from(value: String) -> Result<Self, self::error::ConversionError> {
value.parse()
}
}

View File

@ -8,6 +8,36 @@ pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
/// Error types.
pub mod error {
/// Error from a TryFrom or FromStr implementation.
pub struct ConversionError(std::borrow::Cow<'static, str>);
impl std::error::Error for ConversionError {}
impl std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Display::fmt(&self.0, f)
}
}
impl std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///BodyWithDefaults
///
/// <details><summary>JSON schema</summary>
@ -112,6 +142,7 @@ pub mod types {
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct BodyWithDefaults {
@ -176,8 +207,8 @@ pub mod types {
}
impl std::convert::TryFrom<BodyWithDefaults> for super::BodyWithDefaults {
type Error = String;
fn try_from(value: BodyWithDefaults) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: BodyWithDefaults) -> Result<Self, super::error::ConversionError> {
Ok(Self {
forty_two: value.forty_two?,
s: value.s?,
@ -249,8 +280,8 @@ pub mod types {
}
impl std::convert::TryFrom<Error> for super::Error {
type Error = String;
fn try_from(value: Error) -> Result<Self, String> {
type Error = super::error::ConversionError;
fn try_from(value: Error) -> Result<Self, super::error::ConversionError> {
Ok(Self {
error_code: value.error_code?,
message: value.message?,
@ -270,6 +301,7 @@ pub mod types {
}
}
/// Generation of default values for serde.
pub mod defaults {
pub(super) fn default_u64<T, const V: u64>() -> T
where

View File

@ -8,6 +8,36 @@ pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
/// Error types.
pub mod error {
/// Error from a TryFrom or FromStr implementation.
pub struct ConversionError(std::borrow::Cow<'static, str>);
impl std::error::Error for ConversionError {}
impl std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Display::fmt(&self.0, f)
}
}
impl std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///BodyWithDefaults
///
/// <details><summary>JSON schema</summary>
@ -100,6 +130,7 @@ pub mod types {
}
}
/// Generation of default values for serde.
pub mod defaults {
pub(super) fn default_u64<T, const V: u64>() -> T
where

View File

@ -8,6 +8,36 @@ pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
/// Error types.
pub mod error {
/// Error from a TryFrom or FromStr implementation.
pub struct ConversionError(std::borrow::Cow<'static, str>);
impl std::error::Error for ConversionError {}
impl std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Display::fmt(&self.0, f)
}
}
impl std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///Error information from a response.
///
/// <details><summary>JSON schema</summary>

View File

@ -8,6 +8,36 @@ pub mod types {
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::convert::TryFrom;
/// Error types.
pub mod error {
/// Error from a TryFrom or FromStr implementation.
pub struct ConversionError(std::borrow::Cow<'static, str>);
impl std::error::Error for ConversionError {}
impl std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Display::fmt(&self.0, f)
}
}
impl std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///Error information from a response.
///
/// <details><summary>JSON schema</summary>