Skip to content

Commit

Permalink
Update base64 dependency (#515)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Marek Barvíř <[email protected]>
Co-authored-by: Isabel Atkinson <[email protected]>
  • Loading branch information
3 people authored Feb 13, 2025
1 parent 3b756a7 commit aff37cf
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["preserve_order"] }
indexmap = "2.1.0"
hex = "0.4.2"
base64 = "0.13.0"
base64 = "0.22.1"
once_cell = "1.5.1"
uuid-0_8 = { package = "uuid", version = "0.8.1", features = ["serde", "v4"], optional = true }
uuid = { version = "1.1.2", features = ["serde", "v4"] }
Expand Down
9 changes: 9 additions & 0 deletions src/base64.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use base64::{engine::general_purpose::STANDARD, DecodeError, Engine};

pub fn decode<T: AsRef<[u8]>>(input: T) -> Result<Vec<u8>, DecodeError> {
STANDARD.decode(input)
}

pub fn encode<T: AsRef<[u8]>>(input: T) -> String {
STANDARD.encode(input)
}
2 changes: 1 addition & 1 deletion src/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

mod vector;

use crate::{spec::BinarySubtype, Document, RawBinaryRef};
use crate::{base64, spec::BinarySubtype, Document, RawBinaryRef};
use std::{
convert::TryFrom,
error,
Expand Down
1 change: 1 addition & 0 deletions src/bson.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use serde_json::{json, Value};

pub use crate::document::Document;
use crate::{
base64,
oid::{self, ObjectId},
spec::{BinarySubtype, ElementType},
Binary,
Expand Down
1 change: 1 addition & 0 deletions src/de/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use serde::{
};

use crate::{
base64,
oid::ObjectId,
raw::{
RawBinaryRef,
Expand Down
2 changes: 1 addition & 1 deletion src/extjson/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use serde::{
};
use std::borrow::Cow;

use crate::{extjson, oid, raw::serde::CowStr, spec::BinarySubtype, Bson};
use crate::{base64, extjson, oid, raw::serde::CowStr, spec::BinarySubtype, Bson};

#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ pub use self::de::{from_reader_utf8_lossy, from_slice_utf8_lossy};

#[macro_use]
mod macros;
mod base64;
pub mod binary;
mod bson;
pub mod datetime;
Expand Down
1 change: 1 addition & 0 deletions src/raw/bson_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use super::{
Result,
};
use crate::{
base64,
extjson,
oid::{self, ObjectId},
raw::{RawJavaScriptCodeWithScope, RAW_BSON_NEWTYPE},
Expand Down
1 change: 1 addition & 0 deletions src/ser/raw/value_serializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use serde::{
};

use crate::{
base64,
oid::ObjectId,
raw::RAW_DOCUMENT_NEWTYPE,
ser::{write_binary, write_cstring, write_i32, write_i64, write_string, Error, Result},
Expand Down
1 change: 1 addition & 0 deletions src/ser/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use serde::ser::{
};

use crate::{
base64,
bson::{Array, Bson, DbPointer, Document, JavaScriptCodeWithScope, Regex, Timestamp},
datetime::DateTime,
extjson,
Expand Down
2 changes: 1 addition & 1 deletion src/tests/modules/binary.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{spec::BinarySubtype, tests::LOCK, Binary};
use crate::{base64, spec::BinarySubtype, tests::LOCK, Binary};

#[test]
fn binary_from_base64() {
Expand Down
1 change: 1 addition & 0 deletions src/tests/modules/bson.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::{
};

use crate::{
base64,
doc,
oid::ObjectId,
spec::BinarySubtype,
Expand Down
1 change: 1 addition & 0 deletions src/tests/modules/macros.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::{
base64,
doc,
oid::ObjectId,
spec::BinarySubtype,
Expand Down

0 comments on commit aff37cf

Please sign in to comment.