Skip to content

Commit 4689d15

Browse files
authored
RUST-313 Mark enums as non-exhaustive where appropriate (#169)
1 parent a7dd92d commit 4689d15

File tree

5 files changed

+5
-0
lines changed

5 files changed

+5
-0
lines changed

src/decoder/error.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use serde::de::{self, Expected, Unexpected};
44

55
/// Possible errors that can arise during decoding.
66
#[derive(Debug)]
7+
#[non_exhaustive]
78
pub enum DecoderError {
89
IoError(io::Error),
910
FromUtf8Error(string::FromUtf8Error),

src/document.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use crate::{
2424
/// Error to indicate that either a value was empty or it contained an unexpected
2525
/// type, for use with the direct getters.
2626
#[derive(PartialEq)]
27+
#[non_exhaustive]
2728
pub enum ValueAccessError {
2829
/// Cannot find the expected field with the specified key
2930
NotPresent,

src/encoder/error.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::bson::Bson;
66

77
/// Possible errors that can arise during encoding.
88
#[derive(Debug)]
9+
#[non_exhaustive]
910
pub enum EncoderError {
1011
IoError(io::Error),
1112
InvalidMapKeyType(Bson),

src/oid.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ static OID_COUNTER: AtomicUsize = AtomicUsize::new(0);
2727

2828
/// Errors that can occur during OID construction and generation.
2929
#[derive(Debug)]
30+
#[non_exhaustive]
3031
pub enum Error {
3132
ArgumentError(String),
3233
FromHexError(FromHexError),

src/spec.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ impl ElementType {
142142

143143
/// The available binary subtypes, plus a user-defined slot.
144144
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
145+
#[non_exhaustive]
145146
pub enum BinarySubtype {
146147
Generic,
147148
Function,

0 commit comments

Comments
 (0)