Trait algorithmia::prelude::HasDataPath
[−]
[src]
pub trait HasDataPath { fn to_url(&self) -> Result<Url> { ... } fn to_data_uri(&self) -> String { ... } fn parent(&self) -> Option<DataDir> { ... } fn basename(&self) -> Option<String> { ... } fn exists(&self) -> Result<bool> { ... } }
Trait used for types that can be represented with an Algorithmia Data URI
Provided Methods
fn to_url(&self) -> Result<Url>
Get the API Endpoint URL for a particular data URI
fn to_data_uri(&self) -> String
Get the Algorithmia data URI a given Data Object
let my_dir = client.dir(".my/my_dir"); assert_eq!(my_dir.to_data_uri(), "data://.my/my_dir");
fn parent(&self) -> Option<DataDir>
Get the parent off a given Data Object
let my_file = client.file("data://.my/my_dir/my_file"); assert_eq!(my_file.parent().unwrap().to_data_uri(), "data://.my/my_dir");
fn basename(&self) -> Option<String>
Get the basename from the Data Object's path (i.e. unix basename
)
let my_dir = client.dir("data:///.my/my_dir"); assert_eq!(my_dir.basename().unwrap(), "my_dir");
fn exists(&self) -> Result<bool>
Determine if a file or directory exists for a particular data URI
let my_file = client.data("data://.my/my_dir/my_file"); assert_eq!(my_file.exists().unwrap(), true);
Implementors
impl HasDataPath for DataDir
impl HasDataPath for DataFile
impl HasDataPath for DataObject