1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use crate::{compound_types::LimitedVarOpaque, DataValue, StellarSdkError};
use sp_std::vec::Vec;
pub trait IntoDataValue {
fn into_data_value(self) -> Result<DataValue, StellarSdkError>;
}
impl IntoDataValue for DataValue {
fn into_data_value(self) -> Result<DataValue, StellarSdkError> {
Ok(self)
}
}
impl<T: AsRef<[u8]>> IntoDataValue for T {
fn into_data_value(self) -> Result<DataValue, StellarSdkError> {
let value = self.as_ref();
LimitedVarOpaque::new(Vec::from(value))
}
}