pub struct CmnUri {
pub domain: String,
pub hash: Option<String>,
pub kind: CmnUriKind,
}Expand description
Parsed CMN URI
Fields§
§domain: String§hash: Option<String>§kind: CmnUriKindImplementations§
Source§impl CmnUri
impl CmnUri
Sourcepub fn parse(uri: &str) -> Result<Self, String>
pub fn parse(uri: &str) -> Result<Self, String>
Parse a CMN URI string into a CmnUri struct
§Examples
use substrate::CmnUri;
let uri = CmnUri::parse("cmn://example.com/b3.3yMR7vZQ9hL").unwrap();
assert_eq!(uri.domain, "example.com");
assert_eq!(uri.hash, Some("b3.3yMR7vZQ9hL".to_string()));
let taste = CmnUri::parse("cmn://alice.dev/taste/b3.7tRkW2x").unwrap();
assert_eq!(taste.domain, "alice.dev");
assert_eq!(taste.hash, Some("b3.7tRkW2x".to_string()));
assert!(taste.is_taste());Sourcepub fn hash_filename(&self) -> Option<String>
pub fn hash_filename(&self) -> Option<String>
Get hash formatted for use in filenames.
Sourcepub fn is_mycelium(&self) -> bool
pub fn is_mycelium(&self) -> bool
Returns true if this is a mycelium URI.
Trait Implementations§
impl StructuralPartialEq for CmnUri
Auto Trait Implementations§
impl Freeze for CmnUri
impl RefUnwindSafe for CmnUri
impl Send for CmnUri
impl Sync for CmnUri
impl Unpin for CmnUri
impl UnsafeUnpin for CmnUri
impl UnwindSafe for CmnUri
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