pub trait IntoResourcePath {
// Required method
fn into_abs_path(self) -> Result<ResourcePath, Error>;
}Expand description
Convert common input types into a normalized ResourcePath (absolute).
This trait is intentionally implemented for the “obvious” path-like things:
ResourcePath/&ResourcePath(pass-through / clone)&str,String, and&String
It is used by session-scoped storage methods (SessionStorage) that act as
the current user and therefore do not need a PublicKey.
§Examples
fn takes_abs<P: IntoResourcePath>(p: P) -> pubky::Result<ResourcePath> {
p.into_abs_path()
}
let a = takes_abs("/pub/my-cool-app/file")?;
let b = takes_abs("pub/my-cool-app/file")?;
assert_eq!(a, b);Required Methods§
Sourcefn into_abs_path(self) -> Result<ResourcePath, Error>
fn into_abs_path(self) -> Result<ResourcePath, Error>
Convert into a validated, normalized absolute ResourcePath.
§Errors
- Returns
Error::Requestif the input cannot be normalized into a valid absolute path.