Struct sp_core::crypto::AddressUri
source · pub struct AddressUri<'a> {
pub phrase: Option<&'a str>,
pub paths: Vec<&'a str>,
pub pass: Option<&'a str>,
}
Expand description
A container for results of parsing the address uri string.
Intended to be equivalent of:
Regex::new(r"^(?P<phrase>[a-zA-Z0-9 ]+)?(?P<path>(//?[^/]+)*)(///(?P<password>.*))?$")
which also handles soft and hard derivation paths:
Regex::new(r"/(/?[^/]+)")
Example:
use sp_core::crypto::AddressUri;
let manual_result = AddressUri::parse("hello world/s//h///pass");
assert_eq!(
manual_result.unwrap(),
AddressUri { phrase: Some("hello world"), paths: vec!["s", "/h"], pass: Some("pass") }
);
Fields§
§phrase: Option<&'a str>
Phrase, hexadecimal string, or ss58-compatible string.
paths: Vec<&'a str>
Key derivation paths, ordered as in input string,
pass: Option<&'a str>
Password.
Implementations§
Trait Implementations§
source§impl<'a> Debug for AddressUri<'a>
impl<'a> Debug for AddressUri<'a>
source§impl<'a> PartialEq for AddressUri<'a>
impl<'a> PartialEq for AddressUri<'a>
source§fn eq(&self, other: &AddressUri<'a>) -> bool
fn eq(&self, other: &AddressUri<'a>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<'a> StructuralPartialEq for AddressUri<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for AddressUri<'a>
impl<'a> Send for AddressUri<'a>
impl<'a> Sync for AddressUri<'a>
impl<'a> Unpin for AddressUri<'a>
impl<'a> UnwindSafe for AddressUri<'a>
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from
.