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>
impl<'a> StructuralPartialEq for AddressUri<'a>
Auto Trait Implementations§
impl<'a> Freeze for AddressUri<'a>
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§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
.