1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | #[allow(missing_docs)] // documentation missing in model
|
3 + | #[non_exhaustive]
|
4 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
5 + | pub enum EventStream {
|
6 + | #[allow(missing_docs)] // documentation missing in model
|
7 + | BlobPayload(crate::types::BlobPayloadEvent),
|
8 + | #[allow(missing_docs)] // documentation missing in model
|
9 + | Headers(crate::types::HeadersEvent),
|
10 + | #[allow(missing_docs)] // documentation missing in model
|
11 + | HeadersAndExplicitPayload(crate::types::HeadersAndExplicitPayloadEvent),
|
12 + | #[allow(missing_docs)] // documentation missing in model
|
13 + | HeadersAndImplicitPayload(crate::types::HeadersAndImplicitPayloadEvent),
|
14 + | #[allow(missing_docs)] // documentation missing in model
|
15 + | StringPayload(crate::types::StringPayloadEvent),
|
16 + | #[allow(missing_docs)] // documentation missing in model
|
17 + | StructurePayload(crate::types::StructurePayloadEvent),
|
18 + | #[allow(missing_docs)] // documentation missing in model
|
19 + | UnionPayload(crate::types::UnionPayloadEvent),
|
20 + | /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
|
21 + | /// An unknown enum variant
|
22 + | ///
|
23 + | /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._
|
24 + | /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized
|
25 + | /// by the client. This can happen when the server adds new functionality, but the client has not been updated.
|
26 + | /// To investigate this, consider turning on debug logging to print the raw HTTP response.
|
27 + | #[non_exhaustive]
|
28 + | Unknown,
|
29 + | }
|
30 + | impl EventStream {
|
31 + | /// Tries to convert the enum instance into [`BlobPayload`](crate::types::EventStream::BlobPayload), extracting the inner [`BlobPayloadEvent`](crate::types::BlobPayloadEvent).
|
32 + | /// Returns `Err(&Self)` if it can't be converted.
|
33 + | pub fn as_blob_payload(&self) -> ::std::result::Result<&crate::types::BlobPayloadEvent, &Self> {
|
34 + | if let EventStream::BlobPayload(val) = &self {
|
35 + | ::std::result::Result::Ok(val)
|
36 + | } else {
|
37 + | ::std::result::Result::Err(self)
|
38 + | }
|
39 + | }
|
40 + | /// Returns true if this is a [`BlobPayload`](crate::types::EventStream::BlobPayload).
|
41 + | pub fn is_blob_payload(&self) -> bool {
|
42 + | self.as_blob_payload().is_ok()
|
43 + | }
|
44 + | /// Tries to convert the enum instance into [`Headers`](crate::types::EventStream::Headers), extracting the inner [`HeadersEvent`](crate::types::HeadersEvent).
|
45 + | /// Returns `Err(&Self)` if it can't be converted.
|
46 + | pub fn as_headers(&self) -> ::std::result::Result<&crate::types::HeadersEvent, &Self> {
|
47 + | if let EventStream::Headers(val) = &self {
|
48 + | ::std::result::Result::Ok(val)
|
49 + | } else {
|
50 + | ::std::result::Result::Err(self)
|
51 + | }
|
52 + | }
|
53 + | /// Returns true if this is a [`Headers`](crate::types::EventStream::Headers).
|
54 + | pub fn is_headers(&self) -> bool {
|
55 + | self.as_headers().is_ok()
|
56 + | }
|
57 + | /// Tries to convert the enum instance into [`HeadersAndExplicitPayload`](crate::types::EventStream::HeadersAndExplicitPayload), extracting the inner [`HeadersAndExplicitPayloadEvent`](crate::types::HeadersAndExplicitPayloadEvent).
|
58 + | /// Returns `Err(&Self)` if it can't be converted.
|
59 + | pub fn as_headers_and_explicit_payload(&self) -> ::std::result::Result<&crate::types::HeadersAndExplicitPayloadEvent, &Self> {
|
60 + | if let EventStream::HeadersAndExplicitPayload(val) = &self {
|
61 + | ::std::result::Result::Ok(val)
|
62 + | } else {
|
63 + | ::std::result::Result::Err(self)
|
64 + | }
|
65 + | }
|
66 + | /// Returns true if this is a [`HeadersAndExplicitPayload`](crate::types::EventStream::HeadersAndExplicitPayload).
|
67 + | pub fn is_headers_and_explicit_payload(&self) -> bool {
|
68 + | self.as_headers_and_explicit_payload().is_ok()
|
69 + | }
|
70 + | /// Tries to convert the enum instance into [`HeadersAndImplicitPayload`](crate::types::EventStream::HeadersAndImplicitPayload), extracting the inner [`HeadersAndImplicitPayloadEvent`](crate::types::HeadersAndImplicitPayloadEvent).
|
71 + | /// Returns `Err(&Self)` if it can't be converted.
|
72 + | pub fn as_headers_and_implicit_payload(&self) -> ::std::result::Result<&crate::types::HeadersAndImplicitPayloadEvent, &Self> {
|
73 + | if let EventStream::HeadersAndImplicitPayload(val) = &self {
|
74 + | ::std::result::Result::Ok(val)
|
75 + | } else {
|
76 + | ::std::result::Result::Err(self)
|
77 + | }
|
78 + | }
|
79 + | /// Returns true if this is a [`HeadersAndImplicitPayload`](crate::types::EventStream::HeadersAndImplicitPayload).
|
80 + | pub fn is_headers_and_implicit_payload(&self) -> bool {
|
81 + | self.as_headers_and_implicit_payload().is_ok()
|
82 + | }
|
83 + | /// Tries to convert the enum instance into [`StringPayload`](crate::types::EventStream::StringPayload), extracting the inner [`StringPayloadEvent`](crate::types::StringPayloadEvent).
|
84 + | /// Returns `Err(&Self)` if it can't be converted.
|
85 + | pub fn as_string_payload(&self) -> ::std::result::Result<&crate::types::StringPayloadEvent, &Self> {
|
86 + | if let EventStream::StringPayload(val) = &self {
|
87 + | ::std::result::Result::Ok(val)
|
88 + | } else {
|
89 + | ::std::result::Result::Err(self)
|
90 + | }
|
91 + | }
|
92 + | /// Returns true if this is a [`StringPayload`](crate::types::EventStream::StringPayload).
|
93 + | pub fn is_string_payload(&self) -> bool {
|
94 + | self.as_string_payload().is_ok()
|
95 + | }
|
96 + | /// Tries to convert the enum instance into [`StructurePayload`](crate::types::EventStream::StructurePayload), extracting the inner [`StructurePayloadEvent`](crate::types::StructurePayloadEvent).
|
97 + | /// Returns `Err(&Self)` if it can't be converted.
|
98 + | pub fn as_structure_payload(&self) -> ::std::result::Result<&crate::types::StructurePayloadEvent, &Self> {
|
99 + | if let EventStream::StructurePayload(val) = &self {
|
100 + | ::std::result::Result::Ok(val)
|
101 + | } else {
|
102 + | ::std::result::Result::Err(self)
|
103 + | }
|
104 + | }
|
105 + | /// Returns true if this is a [`StructurePayload`](crate::types::EventStream::StructurePayload).
|
106 + | pub fn is_structure_payload(&self) -> bool {
|
107 + | self.as_structure_payload().is_ok()
|
108 + | }
|
109 + | /// Tries to convert the enum instance into [`UnionPayload`](crate::types::EventStream::UnionPayload), extracting the inner [`UnionPayloadEvent`](crate::types::UnionPayloadEvent).
|
110 + | /// Returns `Err(&Self)` if it can't be converted.
|
111 + | pub fn as_union_payload(&self) -> ::std::result::Result<&crate::types::UnionPayloadEvent, &Self> {
|
112 + | if let EventStream::UnionPayload(val) = &self {
|
113 + | ::std::result::Result::Ok(val)
|
114 + | } else {
|
115 + | ::std::result::Result::Err(self)
|
116 + | }
|
117 + | }
|
118 + | /// Returns true if this is a [`UnionPayload`](crate::types::EventStream::UnionPayload).
|
119 + | pub fn is_union_payload(&self) -> bool {
|
120 + | self.as_union_payload().is_ok()
|
121 + | }
|
122 + | /// Returns true if the enum instance is the `Unknown` variant.
|
123 + | pub fn is_unknown(&self) -> bool {
|
124 + | matches!(self, Self::Unknown)
|
125 + | }
|
126 + | }
|