Enum aws_sdk_apigatewayv2::model::EndpointType
source · #[non_exhaustive]
pub enum EndpointType {
Edge,
Regional,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against EndpointType, it is important to ensure
your code is forward-compatible. That is, if a match arm handles a case for a
feature that is supported by the service but has not been represented as an enum
variant in a current version of SDK, your code should continue to work when you
upgrade SDK to a future version in which the enum does include a variant for that
feature.
Here is an example of how you can make a match expression forward-compatible:
# let endpointtype = unimplemented!();
match endpointtype {
EndpointType::Edge => { /* ... */ },
EndpointType::Regional => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when endpointtype represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant EndpointType::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
EndpointType::Unknown(UnknownVariantValue("NewFeature".to_owned()))
and calling as_str on it yields "NewFeature".
This match expression is forward-compatible when executed with a newer
version of SDK where the variant EndpointType::NewFeature is defined.
Specifically, when endpointtype represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on EndpointType::NewFeature also yielding "NewFeature".
Explicitly matching on the Unknown variant should
be avoided for two reasons:
- The inner data
UnknownVariantValueis opaque, and no further information can be extracted. - It might inadvertently shadow other intended match arms.
Represents an endpoint type.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Edge
Regional
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl EndpointType
impl EndpointType
sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the &str value of the enum member.
Examples found in repository?
More examples
1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233
pub fn serialize_structure_crate_model_domain_name_configuration(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::DomainNameConfiguration,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_293) = &input.api_gateway_domain_name {
object.key("apiGatewayDomainName").string(var_293.as_str());
}
if let Some(var_294) = &input.certificate_arn {
object.key("certificateArn").string(var_294.as_str());
}
if let Some(var_295) = &input.certificate_name {
object.key("certificateName").string(var_295.as_str());
}
if let Some(var_296) = &input.certificate_upload_date {
object
.key("certificateUploadDate")
.date_time(var_296, aws_smithy_types::date_time::Format::DateTime)?;
}
if let Some(var_297) = &input.domain_name_status {
object.key("domainNameStatus").string(var_297.as_str());
}
if let Some(var_298) = &input.domain_name_status_message {
object
.key("domainNameStatusMessage")
.string(var_298.as_str());
}
if let Some(var_299) = &input.endpoint_type {
object.key("endpointType").string(var_299.as_str());
}
if let Some(var_300) = &input.hosted_zone_id {
object.key("hostedZoneId").string(var_300.as_str());
}
if let Some(var_301) = &input.security_policy {
object.key("securityPolicy").string(var_301.as_str());
}
if let Some(var_302) = &input.ownership_verification_certificate_arn {
object
.key("ownershipVerificationCertificateArn")
.string(var_302.as_str());
}
Ok(())
}Trait Implementations§
source§impl AsRef<str> for EndpointType
impl AsRef<str> for EndpointType
source§impl Clone for EndpointType
impl Clone for EndpointType
source§fn clone(&self) -> EndpointType
fn clone(&self) -> EndpointType
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for EndpointType
impl Debug for EndpointType
source§impl From<&str> for EndpointType
impl From<&str> for EndpointType
source§impl FromStr for EndpointType
impl FromStr for EndpointType
source§impl Hash for EndpointType
impl Hash for EndpointType
source§impl Ord for EndpointType
impl Ord for EndpointType
source§fn cmp(&self, other: &EndpointType) -> Ordering
fn cmp(&self, other: &EndpointType) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<EndpointType> for EndpointType
impl PartialEq<EndpointType> for EndpointType
source§fn eq(&self, other: &EndpointType) -> bool
fn eq(&self, other: &EndpointType) -> bool
source§impl PartialOrd<EndpointType> for EndpointType
impl PartialOrd<EndpointType> for EndpointType
source§fn partial_cmp(&self, other: &EndpointType) -> Option<Ordering>
fn partial_cmp(&self, other: &EndpointType) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moreimpl Eq for EndpointType
impl StructuralEq for EndpointType
impl StructuralPartialEq for EndpointType
Auto Trait Implementations§
impl RefUnwindSafe for EndpointType
impl Send for EndpointType
impl Sync for EndpointType
impl Unpin for EndpointType
impl UnwindSafe for EndpointType
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.