Enum aws_sdk_lexmodelsv2::model::SortOrder
source · #[non_exhaustive]
pub enum SortOrder {
Ascending,
Descending,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against SortOrder, 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 sortorder = unimplemented!();
match sortorder {
SortOrder::Ascending => { /* ... */ },
SortOrder::Descending => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when sortorder represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant SortOrder::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
SortOrder::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 SortOrder::NewFeature is defined.
Specifically, when sortorder represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on SortOrder::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.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Ascending
Descending
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl SortOrder
impl SortOrder
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
2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391
pub fn serialize_structure_crate_model_aggregated_utterances_sort_by(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::AggregatedUtterancesSortBy,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_425) = &input.attribute {
object.key("attribute").string(var_425.as_str());
}
if let Some(var_426) = &input.order {
object.key("order").string(var_426.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_bot_locale_filter(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::BotLocaleFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_427) = &input.name {
object.key("name").string(var_427.as_str());
}
if let Some(var_428) = &input.values {
let mut array_429 = object.key("values").start_array();
for item_430 in var_428 {
{
array_429.value().string(item_430.as_str());
}
}
array_429.finish();
}
if let Some(var_431) = &input.operator {
object.key("operator").string(var_431.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_bot_locale_sort_by(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::BotLocaleSortBy,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_432) = &input.attribute {
object.key("attribute").string(var_432.as_str());
}
if let Some(var_433) = &input.order {
object.key("order").string(var_433.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_bot_filter(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::BotFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_434) = &input.name {
object.key("name").string(var_434.as_str());
}
if let Some(var_435) = &input.values {
let mut array_436 = object.key("values").start_array();
for item_437 in var_435 {
{
array_436.value().string(item_437.as_str());
}
}
array_436.finish();
}
if let Some(var_438) = &input.operator {
object.key("operator").string(var_438.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_bot_sort_by(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::BotSortBy,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_439) = &input.attribute {
object.key("attribute").string(var_439.as_str());
}
if let Some(var_440) = &input.order {
object.key("order").string(var_440.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_bot_version_sort_by(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::BotVersionSortBy,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_441) = &input.attribute {
object.key("attribute").string(var_441.as_str());
}
if let Some(var_442) = &input.order {
object.key("order").string(var_442.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_built_in_intent_sort_by(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::BuiltInIntentSortBy,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_443) = &input.attribute {
object.key("attribute").string(var_443.as_str());
}
if let Some(var_444) = &input.order {
object.key("order").string(var_444.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_built_in_slot_type_sort_by(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::BuiltInSlotTypeSortBy,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_445) = &input.attribute {
object.key("attribute").string(var_445.as_str());
}
if let Some(var_446) = &input.order {
object.key("order").string(var_446.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_export_filter(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::ExportFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_447) = &input.name {
object.key("name").string(var_447.as_str());
}
if let Some(var_448) = &input.values {
let mut array_449 = object.key("values").start_array();
for item_450 in var_448 {
{
array_449.value().string(item_450.as_str());
}
}
array_449.finish();
}
if let Some(var_451) = &input.operator {
object.key("operator").string(var_451.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_export_sort_by(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::ExportSortBy,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_452) = &input.attribute {
object.key("attribute").string(var_452.as_str());
}
if let Some(var_453) = &input.order {
object.key("order").string(var_453.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_import_filter(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::ImportFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_454) = &input.name {
object.key("name").string(var_454.as_str());
}
if let Some(var_455) = &input.values {
let mut array_456 = object.key("values").start_array();
for item_457 in var_455 {
{
array_456.value().string(item_457.as_str());
}
}
array_456.finish();
}
if let Some(var_458) = &input.operator {
object.key("operator").string(var_458.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_import_sort_by(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::ImportSortBy,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_459) = &input.attribute {
object.key("attribute").string(var_459.as_str());
}
if let Some(var_460) = &input.order {
object.key("order").string(var_460.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_intent_filter(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::IntentFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_461) = &input.name {
object.key("name").string(var_461.as_str());
}
if let Some(var_462) = &input.values {
let mut array_463 = object.key("values").start_array();
for item_464 in var_462 {
{
array_463.value().string(item_464.as_str());
}
}
array_463.finish();
}
if let Some(var_465) = &input.operator {
object.key("operator").string(var_465.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_intent_sort_by(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::IntentSortBy,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_466) = &input.attribute {
object.key("attribute").string(var_466.as_str());
}
if let Some(var_467) = &input.order {
object.key("order").string(var_467.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_slot_filter(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::SlotFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_468) = &input.name {
object.key("name").string(var_468.as_str());
}
if let Some(var_469) = &input.values {
let mut array_470 = object.key("values").start_array();
for item_471 in var_469 {
{
array_470.value().string(item_471.as_str());
}
}
array_470.finish();
}
if let Some(var_472) = &input.operator {
object.key("operator").string(var_472.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_slot_sort_by(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::SlotSortBy,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_473) = &input.attribute {
object.key("attribute").string(var_473.as_str());
}
if let Some(var_474) = &input.order {
object.key("order").string(var_474.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_slot_type_filter(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::SlotTypeFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_475) = &input.name {
object.key("name").string(var_475.as_str());
}
if let Some(var_476) = &input.values {
let mut array_477 = object.key("values").start_array();
for item_478 in var_476 {
{
array_477.value().string(item_478.as_str());
}
}
array_477.finish();
}
if let Some(var_479) = &input.operator {
object.key("operator").string(var_479.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_slot_type_sort_by(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::SlotTypeSortBy,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_480) = &input.attribute {
object.key("attribute").string(var_480.as_str());
}
if let Some(var_481) = &input.order {
object.key("order").string(var_481.as_str());
}
Ok(())
}Trait Implementations§
source§impl Ord for SortOrder
impl Ord for SortOrder
source§impl PartialOrd<SortOrder> for SortOrder
impl PartialOrd<SortOrder> for SortOrder
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 SortOrder
impl StructuralEq for SortOrder
impl StructuralPartialEq for SortOrder
Auto Trait Implementations§
impl RefUnwindSafe for SortOrder
impl Send for SortOrder
impl Sync for SortOrder
impl Unpin for SortOrder
impl UnwindSafe for SortOrder
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.