pub struct IPR(/* private fields */);Expand description
Internal Path Representation.
They obey the following rules:
- Valid UTF-8
- Are path-separated with /
- Do not begin or end with /
- Do not contain . or .. segments
- Do not contain multiple / characters right next to each other
We can actually infallibly convert to these constraints as long as the input we’re working with is already UTF-8, which Rust strings are! It’s worthwhile to note that this is actually much pickier in certain ways than actual UNIX paths, and you may find some imports fail when dealing with non-unicode paths. The official dirtabase/ark policy for these situations is “we aren’t making stuff for your use case.”
Implementations§
Source§impl IPR
impl IPR
Sourcepub fn is_well_formed(src: &str) -> bool
pub fn is_well_formed(src: &str) -> bool
Quick check to see if a string already meets requirements.
Sourcepub fn canonize<'a>(src: &'a str) -> Cow<'a, str>
pub fn canonize<'a>(src: &'a str) -> Cow<'a, str>
Produce a &str in IPR form.
Reuses original string if it’s already suitable. Hence the Cow.
Sourcepub fn force_canonize(src: &str) -> String
pub fn force_canonize(src: &str) -> String
Produce an owned String in IPR form.
Doesn’t short-circuit to reuse existing memory. Just always charges forward with a statically compiled regex and gets ’er done.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for IPR
impl<'de> Deserialize<'de> for IPR
Source§fn deserialize<D>(
deserializer: D,
) -> Result<IPR, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<IPR, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl Ord for IPR
impl Ord for IPR
Source§impl PartialOrd for IPR
impl PartialOrd for IPR
Source§impl Serialize for IPR
impl Serialize for IPR
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for IPR
impl StructuralPartialEq for IPR
Auto Trait Implementations§
impl Freeze for IPR
impl RefUnwindSafe for IPR
impl Send for IPR
impl Sync for IPR
impl Unpin for IPR
impl UnwindSafe for IPR
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.