pub struct UR {
pub ur_type: String,
pub cbor: CBOR,
}Expand description
A Uniform Resource (UR) is a URI-encoded CBOR object.
Fields§
§ur_type: String§cbor: CBORImplementations§
source§impl UR
impl UR
sourcepub fn new<T: Into<String>, C: CBOREncodable>(
ur_type: T,
cbor: &C
) -> Result<UR, Error>
pub fn new<T: Into<String>, C: CBOREncodable>( ur_type: T, cbor: &C ) -> Result<UR, Error>
Creates a new UR from the provided type and CBOR.
sourcepub fn from_ur_string<T: Into<String>>(ur_string: T) -> Result<UR, Error>
pub fn from_ur_string<T: Into<String>>(ur_string: T) -> Result<UR, Error>
Creates a new UR from the provided UR string.
sourcepub fn qr_string(&self) -> String
pub fn qr_string(&self) -> String
Returns the String representation of the UR in uppercase, most-efficient for QR codes.
sourcepub fn qr_data(&self) -> Vec<u8> ⓘ
pub fn qr_data(&self) -> Vec<u8> ⓘ
Returns the data representation of the UR in uppercase, most-efficient for QR codes.
sourcepub fn check_type(&self, ur_type: &str) -> Result<(), Error>
pub fn check_type(&self, ur_type: &str) -> Result<(), Error>
Checks the UR type against the provided type.
Trait Implementations§
impl StructuralPartialEq for UR
Auto Trait Implementations§
impl RefUnwindSafe for UR
impl Send for UR
impl Sync for UR
impl Unpin for UR
impl UnwindSafe for UR
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more