Use `AssetInfo` or `AssetInfoUnchecked` as `KeyDeserialize::Output` for `AssetInfoKey`
y-pakorn opened this issue · comments
We can use AssetInfo
or AssetInfoUnchecked
as KeyDeserialize::Output
for AssetInfoKey
here to avoid unnecessary casting step.
impl KeyDeserialize for AssetInfoKey {
type Output = Self;
#[inline(always)]
fn from_vec(value: Vec<u8>) -> StdResult<Self::Output> {
Ok(Self(value))
}
}
impl KeyDeserialize for AssetInfoKey {
type Output = AssetInfoUnchecked;
#[inline(always)]
fn from_vec(value: Vec<u8>) -> StdResult<Self::Output> {
Self::Output::try_from(Self(value))
}
}