start base64 serialiser

master
Avril 4 years ago
parent 093930b57d
commit f6d89fdfb7
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -70,6 +70,10 @@ pub mod serialise
{ {
use super::*; use super::*;
/// Serialise this object into base64 text
///
/// # TODO
/// Line wrapping
#[instrument(err, skip(value), fields(value_type=?std::any::type_name::<T>()))] #[instrument(err, skip(value), fields(value_type=?std::any::type_name::<T>()))]
pub fn into_text<T: Serialize>(value: &T) -> Result<String, Error> pub fn into_text<T: Serialize>(value: &T) -> Result<String, Error>
{ {
@ -108,6 +112,7 @@ pub mod serialise
} }
} }
/// Try to deserialise this object from text.
#[instrument(err, skip(string), fields(string = ?string.as_ref()))] #[instrument(err, skip(string), fields(string = ?string.as_ref()))]
pub fn from_text<T: serde::de::DeserializeOwned>(string: impl AsRef<[u8]>) -> Result<T, Error> pub fn from_text<T: serde::de::DeserializeOwned>(string: impl AsRef<[u8]>) -> Result<T, Error>
{ {

Loading…
Cancel
Save