Skip to content

Commit 726bcea

Browse files
authored
feat: mark selected public enums as #[non_exhaustive] (part of #1016) (#1040)
- lambda-events (dynamodb): StreamViewType, StreamStatus, SharedIteratorType, OperationType, KeyType - lambda-http: PayloadError, JsonPayloadError, FormUrlEncodedPayloadError These enums are likely to grow; marking them non_exhaustive helps avoid semver hazards for downstream consumers who pattern-match exhaustively.
1 parent 4c4e5fa commit 726bcea

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lambda-events/src/event/dynamodb/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use std::fmt;
1313
mod attributes;
1414

1515
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
16+
#[non_exhaustive]
1617
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
1718
pub enum StreamViewType {
1819
NewImage,
@@ -35,6 +36,7 @@ impl fmt::Display for StreamViewType {
3536
}
3637

3738
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
39+
#[non_exhaustive]
3840
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
3941
pub enum StreamStatus {
4042
Enabling,
@@ -57,6 +59,7 @@ impl fmt::Display for StreamStatus {
5759
}
5860

5961
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
62+
#[non_exhaustive]
6063
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
6164
pub enum SharedIteratorType {
6265
TrimHorizon,
@@ -79,6 +82,7 @@ impl fmt::Display for SharedIteratorType {
7982
}
8083

8184
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
85+
#[non_exhaustive]
8286
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
8387
pub enum OperationType {
8488
#[default]
@@ -99,6 +103,7 @@ impl fmt::Display for OperationType {
99103
}
100104

101105
#[derive(Clone, Default, Debug, Deserialize, Eq, PartialEq, Serialize)]
106+
#[non_exhaustive]
102107
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
103108
pub enum KeyType {
104109
#[default]

lambda-http/src/ext/request.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use crate::Body;
1313
///
1414
/// Returned by [`RequestPayloadExt::payload()`]
1515
#[derive(Debug)]
16+
#[non_exhaustive]
1617
pub enum PayloadError {
1718
/// Returned when `application/json` bodies fail to deserialize a payload
1819
Json(serde_json::Error),
@@ -22,13 +23,15 @@ pub enum PayloadError {
2223

2324
/// Indicates a problem processing a JSON payload.
2425
#[derive(Debug)]
26+
#[non_exhaustive]
2527
pub enum JsonPayloadError {
2628
/// Problem deserializing a JSON payload.
2729
Parsing(serde_json::Error),
2830
}
2931

3032
/// Indicates a problem processing an x-www-form-urlencoded payload.
3133
#[derive(Debug)]
34+
#[non_exhaustive]
3235
pub enum FormUrlEncodedPayloadError {
3336
/// Problem deserializing an x-www-form-urlencoded payload.
3437
Parsing(SerdeError),

0 commit comments

Comments
 (0)