Struct offchain::identifier::Intent [−][src]
pub struct Intent { /* fields omitted */ }Expand description
Intent is a struct holdind data decoded from Diem Intent Identifier string https://dip.diem.com/dip-5/#format
Implementations
Encode Intent as a Diem intent identifier (https://dip.diem.com/dip-5/).
Example
use offchain::identifier::Intent;
use std::str::FromStr;
let identifier = "diem://dm1p7ujcndcl7nudzwt8fglhx6wxn08kgs5tm6mz4us2vfufk?c=XUS&am=4500";
let intent = Intent::from_str(identifier).unwrap();
assert_eq!(intent.to_encoded_string().unwrap(), identifier);Trait Implementations
Decode Diem intent identifier (https://dip.diem.com/dip-5/) int 3 parts:
- account identifier: account address & sub-address
- currency
- amount
Example
use offchain::identifier::HumanReadablePrefix;
use offchain::identifier::Intent;
use std::str::FromStr;
let identifier = "diem://dm1p7ujcndcl7nudzwt8fglhx6wxn08kgs5tm6mz4us2vfufk?c=XUS&am=4500";
let intent = Intent::from_str(identifier).unwrap();
assert_eq!(intent.hrp(), &HumanReadablePrefix::DM);
assert_eq!(intent.amount(), Some(4500));type Err = IntentIdentifierError
type Err = IntentIdentifierError
The associated error which can be returned from parsing.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for Intent
impl UnwindSafe for Intent
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
type Output = T
type Output = T
Should always be Self