1use dcbor::prelude::*;
2
3use crate::UR;
4
5pub trait URDecodable: CBORTaggedDecodable {
7 fn from_ur(ur: impl AsRef<UR>) -> dcbor::Result<Self> where Self: Sized {
8 ur.as_ref().check_type(Self::cbor_tags()[0].name().as_ref().unwrap().clone())?;
9 Self::from_untagged_cbor(ur.as_ref().clone().into())
10 }
11
12 fn from_ur_string(ur_string: impl Into<String>) -> dcbor::Result<Self> where Self: Sized {
13 Self::from_ur(UR::from_ur_string(ur_string)?)
14 }
15}
16
17impl<T> URDecodable for T where T: CBORTaggedDecodable {}