Skip to content

Commit c8ae1b4

Browse files
RUST-524 mark structs non_exhaustive (#225)
1 parent 284985f commit c8ae1b4

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

src/client/auth/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ impl FromStr for AuthMechanism {
221221
/// Some fields (mechanism and source) may be omitted and will either be negotiated or assigned a
222222
/// default value, depending on the values of other fields in the credential.
223223
#[derive(Clone, Debug, Default, Deserialize, TypedBuilder, PartialEq)]
224+
#[non_exhaustive]
224225
pub struct Credential {
225226
/// The username to authenticate with. This applies to all mechanisms but may be omitted when
226227
/// authenticating via MONGODB-X509.

src/collation.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use typed_builder::TypedBuilder;
77
#[serde_with::skip_serializing_none]
88
#[derive(Clone, Debug, Default, Serialize, Deserialize, TypedBuilder)]
99
#[serde(rename_all = "camelCase")]
10+
#[non_exhaustive]
1011
pub struct Collation {
1112
/// The ICU locale.
1213
///

src/error.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub type Result<T> = std::result::Result<T, Error>;
2525
/// cloned.
2626
#[derive(Clone, Debug, Error)]
2727
#[error(display = "{}", kind)]
28+
#[non_exhaustive]
2829
pub struct Error {
2930
/// The type of error that occurred.
3031
pub kind: Arc<ErrorKind>,

src/results.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use serde::Serialize;
1010
/// operation.
1111
#[derive(Debug, Serialize)]
1212
#[serde(rename_all = "camelCase")]
13+
#[non_exhaustive]
1314
pub struct InsertOneResult {
1415
/// The `_id` field of the document inserted.
1516
pub inserted_id: Bson,
@@ -31,6 +32,7 @@ impl InsertOneResult {
3132
/// operation.
3233
#[derive(Debug, Serialize)]
3334
#[serde(rename_all = "camelCase")]
35+
#[non_exhaustive]
3436
pub struct InsertManyResult {
3537
/// The `_id` field of the documents inserted.
3638
pub inserted_ids: HashMap<usize, Bson>,
@@ -48,6 +50,7 @@ impl InsertManyResult {
4850
/// [`Collection::update_many`](../struct.Collection.html#method.update_many) operation.
4951
#[derive(Debug, Serialize)]
5052
#[serde(rename_all = "camelCase")]
53+
#[non_exhaustive]
5154
pub struct UpdateResult {
5255
/// The number of documents that matched the filter.
5356
pub matched_count: i64,
@@ -61,6 +64,7 @@ pub struct UpdateResult {
6164
/// [`Collection::delete_many`](../struct.Collection.html#method.delete_many) operation.
6265
#[derive(Debug, Serialize)]
6366
#[serde(rename_all = "camelCase")]
67+
#[non_exhaustive]
6468
pub struct DeleteResult {
6569
/// The number of documents deleted by the operation.
6670
pub deleted_count: i64,

0 commit comments

Comments
 (0)