forked from aws/aws-lambda-rust-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod.rs
More file actions
39 lines (32 loc) · 951 Bytes
/
Copy pathmod.rs
File metadata and controls
39 lines (32 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use serde::{Deserialize, Serialize};
use std::ops::{Deref, DerefMut};
#[cfg(feature = "chrono")]
mod time;
use crate::custom_serde::{deserialize_base64, serialize_base64};
#[cfg(feature = "chrono")]
#[cfg_attr(docsrs, doc(cfg(feature = "chrono")))]
pub use self::time::*;
#[cfg(feature = "http")]
mod http;
#[cfg(feature = "http")]
#[cfg_attr(docsrs, doc(cfg(feature = "http")))]
pub use self::http::*;
pub type Error = Box<dyn std::error::Error + Send + Sync>;
/// Binary data encoded in base64.
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct Base64Data(
#[serde(deserialize_with = "deserialize_base64")]
#[serde(serialize_with = "serialize_base64")]
pub Vec<u8>,
);
impl Deref for Base64Data {
type Target = Vec<u8>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl DerefMut for Base64Data {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}