Skip to main content

dfx_base/fields/converters/
mod.rs

1pub mod datetime;
2pub use datetime::{DateTime, Time, Date};
3mod string;
4pub use string::*;
5
6mod int;
7pub mod r#bool;
8
9mod decimal;
10pub use decimal::*;
11
12use crate::field_map::FieldValue;
13
14pub trait TryFrom<T>
15where
16    Self: Sized,
17{
18    type Error;
19    fn try_from(value: T) -> Result<Self, Self::Error>;
20}
21
22pub trait IntoBytes<T>
23where
24    Self: Sized,
25{
26    fn as_bytes(&self) -> T;
27}
28
29impl IntoBytes<FieldValue> for &std::sync::Arc<[u8]> {
30    fn as_bytes(&self) -> FieldValue {
31        self.to_vec().into()
32    }
33}