aws_smithy_runtime_api/client/interceptors/context/
phase.rs

1/*
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
6#[derive(Debug)]
7#[non_exhaustive]
8pub(crate) enum Phase {
9    /// Represents the phase of an operation prior to serialization.
10    BeforeSerialization,
11    /// Represents the phase of an operation where the request is serialized.
12    Serialization,
13    /// Represents the phase of an operation prior to transmitting a request over the network.
14    BeforeTransmit,
15    /// Represents the phase of an operation where the request is transmitted over the network.
16    Transmit,
17    /// Represents the phase of an operation prior to parsing a response.
18    BeforeDeserialization,
19    /// Represents the phase of an operation where the response is parsed.
20    Deserialization,
21    /// Represents the phase of an operation after parsing a response.
22    AfterDeserialization,
23}
24
25impl Phase {
26    pub(crate) fn is_before_serialization(&self) -> bool {
27        matches!(self, Self::BeforeSerialization)
28    }
29
30    pub(crate) fn is_serialization(&self) -> bool {
31        matches!(self, Self::Serialization)
32    }
33
34    pub(crate) fn is_before_transmit(&self) -> bool {
35        matches!(self, Self::BeforeTransmit)
36    }
37
38    pub(crate) fn is_transmit(&self) -> bool {
39        matches!(self, Self::Transmit)
40    }
41
42    pub(crate) fn is_before_deserialization(&self) -> bool {
43        matches!(self, Self::BeforeDeserialization)
44    }
45
46    pub(crate) fn is_deserialization(&self) -> bool {
47        matches!(self, Self::Deserialization)
48    }
49
50    pub(crate) fn is_after_deserialization(&self) -> bool {
51        matches!(self, Self::AfterDeserialization)
52    }
53}