pub struct ErnParser { /* private fields */ }Expand description
A parser for converting ERN strings into structured Ern objects.
The ErnParser takes an ERN string in the format ern:domain:category:account:root/part1/part2/...
and parses it into its constituent components, performing validation on each part.
Implementations§
Source§impl ErnParser
impl ErnParser
Sourcepub fn parse(&self) -> Result<Ern, ErnError>
pub fn parse(&self) -> Result<Ern, ErnError>
Parses the ERN string into a structured Ern object.
This method validates the ERN format, extracts each component, and ensures all parts meet the validation requirements.
§Returns
Ok(Ern)- A structured Ern object containing all the parsed componentsErr(ErnError)- If the ERN string is invalid or any component fails validation
§Example
let parser = ErnParser::new("ern:my-app:users:tenant123:profile/settings".to_string());
let ern = parser.parse()?;
assert_eq!(ern.domain.as_str(), "my-app");
assert_eq!(ern.category.as_str(), "users");
assert_eq!(ern.account.as_str(), "tenant123");
assert_eq!(ern.parts.to_string(), "settings");Auto Trait Implementations§
impl Freeze for ErnParser
impl RefUnwindSafe for ErnParser
impl Send for ErnParser
impl Sync for ErnParser
impl Unpin for ErnParser
impl UnwindSafe for ErnParser
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