pub mod error {
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())
}
}
}
pub enum PublicDestinationType {
#[serde(rename = "public")]
Public,
}
impl ::std::fmt::Display for PublicDestinationType {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Public => f.write_str("public"),
}
}
}
impl ::std::str::FromStr for PublicDestinationType {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"public" => Ok(Self::Public),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for PublicDestinationType {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for PublicDestinationType {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for PublicDestinationType {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
#[derive(Clone, Debug)]
pub struct PublicIpApiResponseCommon {
errors: ::std::result::Result<super::PublicIpMessages, ::std::string::String>,
messages: ::std::result::Result<super::PublicIpMessages, ::std::string::String>,
success: ::std::result::Result<bool, ::std::string::String>,
}
impl ::std::default::Default for PublicIpApiResponseCommon {
fn default() -> Self {
Self {
errors: Err("no value supplied for errors".to_string()),
messages: Err("no value supplied for messages".to_string()),
success: Err("no value supplied for success".to_string()),
}
}
}
impl PublicIpApiResponseCommon {
pub fn errors<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::PublicIpMessages>,
T::Error: ::std::fmt::Display,
{
self.errors = value
.try_into()
.map_err(|e| format!("error converting supplied value for errors: {e}"));
self
}
pub fn messages<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::PublicIpMessages>,
T::Error: ::std::fmt::Display,
{
self.messages = value
.try_into()
.map_err(|e| format!("error converting supplied value for messages: {e}"));
self
}
pub fn success<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.success = value
.try_into()
.map_err(|e| format!("error converting supplied value for success: {e}"));
self
}
}
impl ::std::convert::TryFrom<PublicIpApiResponseCommon> for super::PublicIpApiResponseCommon {
type Error = super::error::ConversionError;
fn try_from(
value: PublicIpApiResponseCommon,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
errors: value.errors?,
messages: value.messages?,
success: value.success?,
})
}
}
impl ::std::convert::From<super::PublicIpApiResponseCommon> for PublicIpApiResponseCommon {
fn from(value: super::PublicIpApiResponseCommon) -> Self {
Self {
errors: Ok(value.errors),
messages: Ok(value.messages),
success: Ok(value.success),
}
}
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug)]
pub struct PublicIpApiResponseCommonFailure {
errors: ::std::result::Result<
::std::vec::Vec<super::PublicIpApiResponseCommonFailureErrorsItem>,
::std::string::String,
>,
messages: ::std::result::Result<super::PublicIpMessages, ::std::string::String>,
result: ::std::result::Result<(), ::std::string::String>,
success: ::std::result::Result<bool, ::std::string::String>,
}
impl ::std::default::Default for PublicIpApiResponseCommonFailure {
fn default() -> Self {
Self {
errors: Err("no value supplied for errors".to_string()),
messages: Err("no value supplied for messages".to_string()),
result: Err("no value supplied for result".to_string()),
success: Err("no value supplied for success".to_string()),
}
}
}
impl PublicIpApiResponseCommonFailure {
pub fn errors<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::vec::Vec<super::PublicIpApiResponseCommonFailureErrorsItem>,
>,
T::Error: ::std::fmt::Display,
{
self.errors = value
.try_into()
.map_err(|e| format!("error converting supplied value for errors: {e}"));
self
}
pub fn messages<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::PublicIpMessages>,
T::Error: ::std::fmt::Display,
{
self.messages = value
.try_into()
.map_err(|e| format!("error converting supplied value for messages: {e}"));
self
}
pub fn result<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<()>,
T::Error: ::std::fmt::Display,
{
self.result = value
.try_into()
.map_err(|e| format!("error converting supplied value for result: {e}"));
self
}
pub fn success<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.success = value
.try_into()
.map_err(|e| format!("error converting supplied value for success: {e}"));
self
}
}
impl ::std::convert::TryFrom<PublicIpApiResponseCommonFailure>
for super::PublicIpApiResponseCommonFailure
{
type Error = super::error::ConversionError;
fn try_from(
value: PublicIpApiResponseCommonFailure,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
errors: value.errors?,
messages: value.messages?,
result: value.result?,
success: value.success?,
})
}
}
impl ::std::convert::From<super::PublicIpApiResponseCommonFailure>
for PublicIpApiResponseCommonFailure
{
fn from(value: super::PublicIpApiResponseCommonFailure) -> Self {
Self {
errors: Ok(value.errors),
messages: Ok(value.messages),
result: Ok(value.result),
success: Ok(value.success),
}
}
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug)]
pub struct PublicIpApiResponseCommonFailureErrorsItem {
code: ::std::result::Result<i64, ::std::string::String>,
documentation_url: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
message: ::std::result::Result<::std::string::String, ::std::string::String>,
source: ::std::result::Result<
::std::option::Option<super::PublicIpApiResponseCommonFailureErrorsItemSource>,
::std::string::String,
>,
}
impl ::std::default::Default for PublicIpApiResponseCommonFailureErrorsItem {
fn default() -> Self {
Self {
code: Err("no value supplied for code".to_string()),
documentation_url: Ok(Default::default()),
message: Err("no value supplied for message".to_string()),
source: Ok(Default::default()),
}
}
}
impl PublicIpApiResponseCommonFailureErrorsItem {
pub fn code<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<i64>,
T::Error: ::std::fmt::Display,
{
self.code = value
.try_into()
.map_err(|e| format!("error converting supplied value for code: {e}"));
self
}
pub fn documentation_url<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.documentation_url = value.try_into().map_err(|e| {
format!("error converting supplied value for documentation_url: {e}")
});
self
}
pub fn message<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::string::String>,
T::Error: ::std::fmt::Display,
{
self.message = value
.try_into()
.map_err(|e| format!("error converting supplied value for message: {e}"));
self
}
pub fn source<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<super::PublicIpApiResponseCommonFailureErrorsItemSource>,
>,
T::Error: ::std::fmt::Display,
{
self.source = value
.try_into()
.map_err(|e| format!("error converting supplied value for source: {e}"));
self
}
}
impl ::std::convert::TryFrom<PublicIpApiResponseCommonFailureErrorsItem>
for super::PublicIpApiResponseCommonFailureErrorsItem
{
type Error = super::error::ConversionError;
fn try_from(
value: PublicIpApiResponseCommonFailureErrorsItem,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
code: value.code?,
documentation_url: value.documentation_url?,
message: value.message?,
source: value.source?,
})
}
}
impl ::std::convert::From<super::PublicIpApiResponseCommonFailureErrorsItem>
for PublicIpApiResponseCommonFailureErrorsItem
{
fn from(value: super::PublicIpApiResponseCommonFailureErrorsItem) -> Self {
Self {
code: Ok(value.code),
documentation_url: Ok(value.documentation_url),
message: Ok(value.message),
source: Ok(value.source),
}
}
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug)]
pub struct PublicIpApiResponseCommonFailureErrorsItemSource {
pointer: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
}
impl ::std::default::Default for PublicIpApiResponseCommonFailureErrorsItemSource {
fn default() -> Self {
Self {
pointer: Ok(Default::default()),
}
}
}
impl PublicIpApiResponseCommonFailureErrorsItemSource {
pub fn pointer<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.pointer = value
.try_into()
.map_err(|e| format!("error converting supplied value for pointer: {e}"));
self
}
}
impl ::std::convert::TryFrom<PublicIpApiResponseCommonFailureErrorsItemSource>
for super::PublicIpApiResponseCommonFailureErrorsItemSource
{
type Error = super::error::ConversionError;
fn try_from(
value: PublicIpApiResponseCommonFailureErrorsItemSource,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
pointer: value.pointer?,
})
}
}
impl ::std::convert::From<super::PublicIpApiResponseCommonFailureErrorsItemSource>
for PublicIpApiResponseCommonFailureErrorsItemSource
{
fn from(value: super::PublicIpApiResponseCommonFailureErrorsItemSource) -> Self {
Self {
pointer: Ok(value.pointer),
}
}
}
#[derive(Clone, Debug)]
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct PublicIpApiResponseSingle(pub PublicIpApiResponseCommon);
impl ::std::ops::Deref for PublicIpApiResponseSingle {
type Target = PublicIpApiResponseCommon;
fn deref(&self) -> &PublicIpApiResponseCommon {
&self.0
}
}
impl ::std::convert::From<PublicIpApiResponseSingle> for PublicIpApiResponseCommon {
fn from(value: PublicIpApiResponseSingle) -> Self {
value.0
}
}
impl ::std::convert::From<PublicIpApiResponseCommon> for PublicIpApiResponseSingle {
fn from(value: PublicIpApiResponseCommon) -> Self {
Self(value)
}
}
#[derive(
:: serde :: Deserialize,
:: serde :: Serialize,
Clone,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[serde(transparent)]
#[serde(transparent)]
pub struct PublicIpEtag(pub ::std::string::String);
impl ::std::ops::Deref for PublicIpEtag {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PublicIpEtag> for ::std::string::String {
fn from(value: PublicIpEtag) -> Self {
value.0
}
}
impl ::std::convert::From<::std::string::String> for PublicIpEtag {
fn from(value: ::std::string::String) -> Self {
Self(value)
}
}
impl ::std::str::FromStr for PublicIpEtag {
type Err = ::std::convert::Infallible;
fn from_str(value: &str) -> ::std::result::Result<Self, Self::Err> {
Ok(Self(value.to_string()))
}
}
impl ::std::fmt::Display for PublicIpEtag {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
self.0.fmt(f)
}
}
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
#[derive(Clone, Debug)]
pub struct PublicIpIps {
etag: ::std::result::Result<
::std::option::Option<super::PublicIpEtag>,
::std::string::String,
>,
ipv4_cidrs: ::std::result::Result<
::std::option::Option<super::PublicIpIpv4Cidrs>,
::std::string::String,
>,
ipv6_cidrs: ::std::result::Result<
::std::option::Option<super::PublicIpIpv6Cidrs>,
::std::string::String,
>,
}
impl ::std::default::Default for PublicIpIps {
fn default() -> Self {
Self {
etag: Ok(Default::default()),
ipv4_cidrs: Ok(Default::default()),
ipv6_cidrs: Ok(Default::default()),
}
}
}
impl PublicIpIps {
pub fn etag<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PublicIpEtag>>,
T::Error: ::std::fmt::Display,
{
self.etag = value
.try_into()
.map_err(|e| format!("error converting supplied value for etag: {e}"));
self
}
pub fn ipv4_cidrs<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PublicIpIpv4Cidrs>>,
T::Error: ::std::fmt::Display,
{
self.ipv4_cidrs = value
.try_into()
.map_err(|e| format!("error converting supplied value for ipv4_cidrs: {e}"));
self
}
pub fn ipv6_cidrs<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PublicIpIpv6Cidrs>>,
T::Error: ::std::fmt::Display,
{
self.ipv6_cidrs = value
.try_into()
.map_err(|e| format!("error converting supplied value for ipv6_cidrs: {e}"));
self
}
}
impl ::std::convert::TryFrom<PublicIpIps> for super::PublicIpIps {
type Error = super::error::ConversionError;
fn try_from(
value: PublicIpIps,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
etag: value.etag?,
ipv4_cidrs: value.ipv4_cidrs?,
ipv6_cidrs: value.ipv6_cidrs?,
})
}
}
impl ::std::convert::From<super::PublicIpIps> for PublicIpIps {
fn from(value: super::PublicIpIps) -> Self {
Self {
etag: Ok(value.etag),
ipv4_cidrs: Ok(value.ipv4_cidrs),
ipv6_cidrs: Ok(value.ipv6_cidrs),
}
}
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug)]
pub struct PublicIpIpsJdcloud {
etag: ::std::result::Result<
::std::option::Option<super::PublicIpEtag>,
::std::string::String,
>,
ipv4_cidrs: ::std::result::Result<
::std::option::Option<super::PublicIpIpv4Cidrs>,
::std::string::String,
>,
ipv6_cidrs: ::std::result::Result<
::std::option::Option<super::PublicIpIpv6Cidrs>,
::std::string::String,
>,
jdcloud_cidrs: ::std::result::Result<
::std::option::Option<super::PublicIpJdcloudCidrs>,
::std::string::String,
>,
}
impl ::std::default::Default for PublicIpIpsJdcloud {
fn default() -> Self {
Self {
etag: Ok(Default::default()),
ipv4_cidrs: Ok(Default::default()),
ipv6_cidrs: Ok(Default::default()),
jdcloud_cidrs: Ok(Default::default()),
}
}
}
impl PublicIpIpsJdcloud {
pub fn etag<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PublicIpEtag>>,
T::Error: ::std::fmt::Display,
{
self.etag = value
.try_into()
.map_err(|e| format!("error converting supplied value for etag: {e}"));
self
}
pub fn ipv4_cidrs<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PublicIpIpv4Cidrs>>,
T::Error: ::std::fmt::Display,
{
self.ipv4_cidrs = value
.try_into()
.map_err(|e| format!("error converting supplied value for ipv4_cidrs: {e}"));
self
}
pub fn ipv6_cidrs<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PublicIpIpv6Cidrs>>,
T::Error: ::std::fmt::Display,
{
self.ipv6_cidrs = value
.try_into()
.map_err(|e| format!("error converting supplied value for ipv6_cidrs: {e}"));
self
}
pub fn jdcloud_cidrs<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PublicIpJdcloudCidrs>>,
T::Error: ::std::fmt::Display,
{
self.jdcloud_cidrs = value
.try_into()
.map_err(|e| format!("error converting supplied value for jdcloud_cidrs: {e}"));
self
}
}
impl ::std::convert::TryFrom<PublicIpIpsJdcloud> for super::PublicIpIpsJdcloud {
type Error = super::error::ConversionError;
fn try_from(
value: PublicIpIpsJdcloud,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
etag: value.etag?,
ipv4_cidrs: value.ipv4_cidrs?,
ipv6_cidrs: value.ipv6_cidrs?,
jdcloud_cidrs: value.jdcloud_cidrs?,
})
}
}
impl ::std::convert::From<super::PublicIpIpsJdcloud> for PublicIpIpsJdcloud {
fn from(value: super::PublicIpIpsJdcloud) -> Self {
Self {
etag: Ok(value.etag),
ipv4_cidrs: Ok(value.ipv4_cidrs),
ipv6_cidrs: Ok(value.ipv6_cidrs),
jdcloud_cidrs: Ok(value.jdcloud_cidrs),
}
}
}
#[derive(Clone, Debug)]
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct PublicIpIpv4Cidrs(pub ::std::vec::Vec<::std::string::String>);
impl ::std::ops::Deref for PublicIpIpv4Cidrs {
type Target = ::std::vec::Vec<::std::string::String>;
fn deref(&self) -> &::std::vec::Vec<::std::string::String> {
&self.0
}
}
impl ::std::convert::From<PublicIpIpv4Cidrs> for ::std::vec::Vec<::std::string::String> {
fn from(value: PublicIpIpv4Cidrs) -> Self {
value.0
}
}
impl ::std::convert::From<::std::vec::Vec<::std::string::String>> for PublicIpIpv4Cidrs {
fn from(value: ::std::vec::Vec<::std::string::String>) -> Self {
Self(value)
}
}
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
#[serde(transparent)]
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct PublicIpIpv6Cidrs(pub ::std::vec::Vec<::std::string::String>);
impl ::std::ops::Deref for PublicIpIpv6Cidrs {
type Target = ::std::vec::Vec<::std::string::String>;
fn deref(&self) -> &::std::vec::Vec<::std::string::String> {
&self.0
}
}
impl ::std::convert::From<PublicIpIpv6Cidrs> for ::std::vec::Vec<::std::string::String> {
fn from(value: PublicIpIpv6Cidrs) -> Self {
value.0
}
}
impl ::std::convert::From<::std::vec::Vec<::std::string::String>> for PublicIpIpv6Cidrs {
fn from(value: ::std::vec::Vec<::std::string::String>) -> Self {
Self(value)
}
}
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
#[serde(transparent)]
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct PublicIpJdcloudCidrs(pub ::std::vec::Vec<::std::string::String>);
impl ::std::ops::Deref for PublicIpJdcloudCidrs {
type Target = ::std::vec::Vec<::std::string::String>;
fn deref(&self) -> &::std::vec::Vec<::std::string::String> {
&self.0
}
}
impl ::std::convert::From<PublicIpJdcloudCidrs> for ::std::vec::Vec<::std::string::String> {
fn from(value: PublicIpJdcloudCidrs) -> Self {
value.0
}
}
impl ::std::convert::From<::std::vec::Vec<::std::string::String>> for PublicIpJdcloudCidrs {
fn from(value: ::std::vec::Vec<::std::string::String>) -> Self {
Self(value)
}
}
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
#[serde(transparent)]
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct PublicIpMessages(pub ::std::vec::Vec<PublicIpMessagesItem>);
impl ::std::ops::Deref for PublicIpMessages {
type Target = ::std::vec::Vec<PublicIpMessagesItem>;
fn deref(&self) -> &::std::vec::Vec<PublicIpMessagesItem> {
&self.0
}
}
impl ::std::convert::From<PublicIpMessages> for ::std::vec::Vec<PublicIpMessagesItem> {
fn from(value: PublicIpMessages) -> Self {
value.0
}
}
impl ::std::convert::From<::std::vec::Vec<PublicIpMessagesItem>> for PublicIpMessages {
fn from(value: ::std::vec::Vec<PublicIpMessagesItem>) -> Self {
Self(value)
}
}
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
#[derive(Clone, Debug)]
pub struct PublicIpMessagesItem {
code: ::std::result::Result<i64, ::std::string::String>,
documentation_url: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
message: ::std::result::Result<::std::string::String, ::std::string::String>,
source: ::std::result::Result<
::std::option::Option<super::PublicIpMessagesItemSource>,
::std::string::String,
>,
}
impl ::std::default::Default for PublicIpMessagesItem {
fn default() -> Self {
Self {
code: Err("no value supplied for code".to_string()),
documentation_url: Ok(Default::default()),
message: Err("no value supplied for message".to_string()),
source: Ok(Default::default()),
}
}
}
impl PublicIpMessagesItem {
pub fn code<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<i64>,
T::Error: ::std::fmt::Display,
{
self.code = value
.try_into()
.map_err(|e| format!("error converting supplied value for code: {e}"));
self
}
pub fn documentation_url<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.documentation_url = value.try_into().map_err(|e| {
format!("error converting supplied value for documentation_url: {e}")
});
self
}
pub fn message<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::string::String>,
T::Error: ::std::fmt::Display,
{
self.message = value
.try_into()
.map_err(|e| format!("error converting supplied value for message: {e}"));
self
}
pub fn source<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<super::PublicIpMessagesItemSource>,
>,
T::Error: ::std::fmt::Display,
{
self.source = value
.try_into()
.map_err(|e| format!("error converting supplied value for source: {e}"));
self
}
}
impl ::std::convert::TryFrom<PublicIpMessagesItem> for super::PublicIpMessagesItem {
type Error = super::error::ConversionError;
fn try_from(
value: PublicIpMessagesItem,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
code: value.code?,
documentation_url: value.documentation_url?,
message: value.message?,
source: value.source?,
})
}
}
impl ::std::convert::From<super::PublicIpMessagesItem> for PublicIpMessagesItem {
fn from(value: super::PublicIpMessagesItem) -> Self {
Self {
code: Ok(value.code),
documentation_url: Ok(value.documentation_url),
message: Ok(value.message),
source: Ok(value.source),
}
}
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug)]
pub struct PublicIpMessagesItemSource {
pointer: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
}
impl ::std::default::Default for PublicIpMessagesItemSource {
fn default() -> Self {
Self {
pointer: Ok(Default::default()),
}
}
}
impl PublicIpMessagesItemSource {
pub fn pointer<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.pointer = value
.try_into()
.map_err(|e| format!("error converting supplied value for pointer: {e}"));
self
}
}
impl ::std::convert::TryFrom<PublicIpMessagesItemSource> for super::PublicIpMessagesItemSource {
type Error = super::error::ConversionError;
fn try_from(
value: PublicIpMessagesItemSource,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
pointer: value.pointer?,
})
}
}
impl ::std::convert::From<super::PublicIpMessagesItemSource> for PublicIpMessagesItemSource {
fn from(value: super::PublicIpMessagesItemSource) -> Self {
Self {
pointer: Ok(value.pointer),
}
}
}
#[derive(Clone, Debug)]
#[derive(:: serde :: Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PublicKey(::std::string::String);
impl ::std::ops::Deref for PublicKey {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PublicKey> for ::std::string::String {
fn from(value: PublicKey) -> Self {
value.0
}
}
impl ::std::str::FromStr for PublicKey {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for PublicKey {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for PublicKey {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for PublicKey {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for PublicKey {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]