#[non_exhaustive]
pub enum JobStatus {
    Completed,
    Failed,
    InProgress,
    Stopped,
    StopRequested,
    Submitted,
    Unknown(UnknownVariantValue),
}
Expand description

When writing a match expression against JobStatus, 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 jobstatus = unimplemented!();
match jobstatus {
    JobStatus::Completed => { /* ... */ },
    JobStatus::Failed => { /* ... */ },
    JobStatus::InProgress => { /* ... */ },
    JobStatus::Stopped => { /* ... */ },
    JobStatus::StopRequested => { /* ... */ },
    JobStatus::Submitted => { /* ... */ },
    other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
    _ => { /* ... */ },
}

The above code demonstrates that when jobstatus represents NewFeature, the execution path will lead to the second last match arm, even though the enum does not contain a variant JobStatus::NewFeature in the current version of SDK. The reason is that the variable other, created by the @ operator, is bound to JobStatus::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 JobStatus::NewFeature is defined. Specifically, when jobstatus represents NewFeature, the execution path will hit the second last match arm as before by virtue of calling as_str on JobStatus::NewFeature also yielding "NewFeature".

Explicitly matching on the Unknown variant should be avoided for two reasons:

  • The inner data UnknownVariantValue is 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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Completed

§

Failed

§

InProgress

§

Stopped

§

StopRequested

§

Submitted

§

Unknown(UnknownVariantValue)

Unknown contains new variants that have been added since this code was generated.

Implementations§

Returns the &str value of the enum member.

Examples found in repository?
src/model.rs (line 183)
182
183
184
    fn as_ref(&self) -> &str {
        self.as_str()
    }
More examples
Hide additional examples
src/json_ser.rs (line 1800)
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
pub fn serialize_structure_crate_model_document_classification_job_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::DocumentClassificationJobFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_359) = &input.job_name {
        object.key("JobName").string(var_359.as_str());
    }
    if let Some(var_360) = &input.job_status {
        object.key("JobStatus").string(var_360.as_str());
    }
    if let Some(var_361) = &input.submit_time_before {
        object
            .key("SubmitTimeBefore")
            .date_time(var_361, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    if let Some(var_362) = &input.submit_time_after {
        object
            .key("SubmitTimeAfter")
            .date_time(var_362, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    Ok(())
}

pub fn serialize_structure_crate_model_document_classifier_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::DocumentClassifierFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_363) = &input.status {
        object.key("Status").string(var_363.as_str());
    }
    if let Some(var_364) = &input.document_classifier_name {
        object
            .key("DocumentClassifierName")
            .string(var_364.as_str());
    }
    if let Some(var_365) = &input.submit_time_before {
        object
            .key("SubmitTimeBefore")
            .date_time(var_365, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    if let Some(var_366) = &input.submit_time_after {
        object
            .key("SubmitTimeAfter")
            .date_time(var_366, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    Ok(())
}

pub fn serialize_structure_crate_model_dominant_language_detection_job_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::DominantLanguageDetectionJobFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_367) = &input.job_name {
        object.key("JobName").string(var_367.as_str());
    }
    if let Some(var_368) = &input.job_status {
        object.key("JobStatus").string(var_368.as_str());
    }
    if let Some(var_369) = &input.submit_time_before {
        object
            .key("SubmitTimeBefore")
            .date_time(var_369, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    if let Some(var_370) = &input.submit_time_after {
        object
            .key("SubmitTimeAfter")
            .date_time(var_370, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    Ok(())
}

pub fn serialize_structure_crate_model_endpoint_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::EndpointFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_371) = &input.model_arn {
        object.key("ModelArn").string(var_371.as_str());
    }
    if let Some(var_372) = &input.status {
        object.key("Status").string(var_372.as_str());
    }
    if let Some(var_373) = &input.creation_time_before {
        object
            .key("CreationTimeBefore")
            .date_time(var_373, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    if let Some(var_374) = &input.creation_time_after {
        object
            .key("CreationTimeAfter")
            .date_time(var_374, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    Ok(())
}

pub fn serialize_structure_crate_model_entities_detection_job_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::EntitiesDetectionJobFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_375) = &input.job_name {
        object.key("JobName").string(var_375.as_str());
    }
    if let Some(var_376) = &input.job_status {
        object.key("JobStatus").string(var_376.as_str());
    }
    if let Some(var_377) = &input.submit_time_before {
        object
            .key("SubmitTimeBefore")
            .date_time(var_377, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    if let Some(var_378) = &input.submit_time_after {
        object
            .key("SubmitTimeAfter")
            .date_time(var_378, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    Ok(())
}

pub fn serialize_structure_crate_model_entity_recognizer_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::EntityRecognizerFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_379) = &input.status {
        object.key("Status").string(var_379.as_str());
    }
    if let Some(var_380) = &input.recognizer_name {
        object.key("RecognizerName").string(var_380.as_str());
    }
    if let Some(var_381) = &input.submit_time_before {
        object
            .key("SubmitTimeBefore")
            .date_time(var_381, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    if let Some(var_382) = &input.submit_time_after {
        object
            .key("SubmitTimeAfter")
            .date_time(var_382, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    Ok(())
}

pub fn serialize_structure_crate_model_events_detection_job_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::EventsDetectionJobFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_383) = &input.job_name {
        object.key("JobName").string(var_383.as_str());
    }
    if let Some(var_384) = &input.job_status {
        object.key("JobStatus").string(var_384.as_str());
    }
    if let Some(var_385) = &input.submit_time_before {
        object
            .key("SubmitTimeBefore")
            .date_time(var_385, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    if let Some(var_386) = &input.submit_time_after {
        object
            .key("SubmitTimeAfter")
            .date_time(var_386, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    Ok(())
}

pub fn serialize_structure_crate_model_key_phrases_detection_job_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::KeyPhrasesDetectionJobFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_387) = &input.job_name {
        object.key("JobName").string(var_387.as_str());
    }
    if let Some(var_388) = &input.job_status {
        object.key("JobStatus").string(var_388.as_str());
    }
    if let Some(var_389) = &input.submit_time_before {
        object
            .key("SubmitTimeBefore")
            .date_time(var_389, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    if let Some(var_390) = &input.submit_time_after {
        object
            .key("SubmitTimeAfter")
            .date_time(var_390, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    Ok(())
}

pub fn serialize_structure_crate_model_pii_entities_detection_job_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::PiiEntitiesDetectionJobFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_391) = &input.job_name {
        object.key("JobName").string(var_391.as_str());
    }
    if let Some(var_392) = &input.job_status {
        object.key("JobStatus").string(var_392.as_str());
    }
    if let Some(var_393) = &input.submit_time_before {
        object
            .key("SubmitTimeBefore")
            .date_time(var_393, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    if let Some(var_394) = &input.submit_time_after {
        object
            .key("SubmitTimeAfter")
            .date_time(var_394, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    Ok(())
}

pub fn serialize_structure_crate_model_sentiment_detection_job_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::SentimentDetectionJobFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_395) = &input.job_name {
        object.key("JobName").string(var_395.as_str());
    }
    if let Some(var_396) = &input.job_status {
        object.key("JobStatus").string(var_396.as_str());
    }
    if let Some(var_397) = &input.submit_time_before {
        object
            .key("SubmitTimeBefore")
            .date_time(var_397, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    if let Some(var_398) = &input.submit_time_after {
        object
            .key("SubmitTimeAfter")
            .date_time(var_398, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    Ok(())
}

pub fn serialize_structure_crate_model_targeted_sentiment_detection_job_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::TargetedSentimentDetectionJobFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_399) = &input.job_name {
        object.key("JobName").string(var_399.as_str());
    }
    if let Some(var_400) = &input.job_status {
        object.key("JobStatus").string(var_400.as_str());
    }
    if let Some(var_401) = &input.submit_time_before {
        object
            .key("SubmitTimeBefore")
            .date_time(var_401, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    if let Some(var_402) = &input.submit_time_after {
        object
            .key("SubmitTimeAfter")
            .date_time(var_402, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    Ok(())
}

pub fn serialize_structure_crate_model_topics_detection_job_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::TopicsDetectionJobFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_403) = &input.job_name {
        object.key("JobName").string(var_403.as_str());
    }
    if let Some(var_404) = &input.job_status {
        object.key("JobStatus").string(var_404.as_str());
    }
    if let Some(var_405) = &input.submit_time_before {
        object
            .key("SubmitTimeBefore")
            .date_time(var_405, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    if let Some(var_406) = &input.submit_time_after {
        object
            .key("SubmitTimeAfter")
            .date_time(var_406, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    Ok(())
}

Returns all the &str values of the enum members.

Trait Implementations§

Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more