pub fn serialize_url_safe<S, T>(
to_serialize: &Option<T>,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>Expand description
Helper that can be used in a serde serialize_with derive macro for struct fields that contain base64 encoded data.
Uses the URL safe base64 encoder.
ยงExamples
#[derive(Serialize)]
struct SomeType {
#[serde(serialize_with = "base64::option::serialize_url_safe")]
pub value: Option<Vec<u8>>,
}