pub struct UR { /* private fields */ }Expand description
A Uniform Resource (UR) is a URI-encoded CBOR object.
Implementations§
Source§impl UR
impl UR
Sourcepub fn new(
ur_type: impl TryInto<URType, Error = Error>,
cbor: impl Into<CBOR>,
) -> Result<UR>
pub fn new( ur_type: impl TryInto<URType, Error = Error>, cbor: impl Into<CBOR>, ) -> Result<UR>
Creates a new UR from the provided type and CBOR.
Sourcepub fn from_ur_string(ur_string: impl Into<String>) -> Result<UR>
pub fn from_ur_string(ur_string: impl Into<String>) -> Result<UR>
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,
other_type: impl TryInto<URType, Error = Error>,
) -> Result<()>
pub fn check_type( &self, other_type: impl TryInto<URType, Error = Error>, ) -> Result<()>
Checks the UR type against the provided type.
pub fn ur_type(&self) -> &URType
Sourcepub fn ur_type_str(&self) -> &str
pub fn ur_type_str(&self) -> &str
Returns the UR type.
pub fn cbor(&self) -> CBOR
Trait Implementations§
impl StructuralPartialEq for UR
Auto Trait Implementations§
impl Freeze for UR
impl RefUnwindSafe for UR
impl !Send for UR
impl !Sync for UR
impl Unpin for UR
impl UnwindSafe for UR
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CBOREncodable for T
impl<T> CBOREncodable for T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)