[][src]Struct algorithmia::data::DataDir

pub struct DataDir { /* fields omitted */ }

Algorithmia Data Directory

Methods

impl DataDir[src]

Important traits for DirectoryListing<'a>
pub fn list(&self) -> DirectoryListing[src]

Display Directory details if it exists

Examples

let client = Algorithmia::client("111112222233333444445555566")?;
let my_dir = client.dir(".my/my_dir");
let dir_list = my_dir.list();
for entry in dir_list {
    match entry {
        Ok(DataItem::File(f)) => println!("File: {}", f.to_data_uri()),
        Ok(DataItem::Dir(d)) => println!("Dir: {}", d.to_data_uri()),
        Err(err) => { println!("Error: {}", err); break; },
    }
};

pub fn create<Acl: Into<DataAcl>>(&self, acl: Acl) -> Result<()>[src]

Create a Directory

Use DataAcl::default() or the ReadAcl enum to set the ACL

Examples

let client = Algorithmia::client("111112222233333444445555566")?;
let my_dir = client.dir(".my/my_dir");
match my_dir.create(DataAcl::default()) {
  Ok(_) => println!("Successfully created Directory"),
  Err(e) => println!("Error created directory: {}", e),
};

pub fn delete(&self, force: bool) -> Result<DirectoryDeleted>[src]

Delete a Directory

Examples

let client = Algorithmia::client("111112222233333444445555566")?;
let my_dir = client.dir(".my/my_dir");
match my_dir.delete(false) {
  Ok(_) => println!("Successfully deleted Directory"),
  Err(err) => println!("Error deleting directory: {}", err),
};

pub fn put_file<P: AsRef<Path>>(&self, file_path: P) -> Result<()>[src]

Upload a file to an existing Directory

Examples

let client = Algorithmia::client("111112222233333444445555566")?;
let my_dir = client.dir(".my/my_dir");

match my_dir.put_file("/path/to/file") {
  Ok(_) => println!("Successfully uploaded to: {}", my_dir.to_data_uri()),
  Err(err) => println!("Error uploading file: {}", err),
};

pub fn child<T: HasDataPath>(&self, filename: &str) -> T[src]

Instantiate DataFile or DataDir as a child of this DataDir

Trait Implementations

impl HasDataPath for DataDir[src]

fn to_url(&self) -> Result<Url>[src]

Get the API Endpoint URL for a particular data URI

fn to_data_uri(&self) -> String[src]

Get the Algorithmia data URI a given Data Object Read more

fn parent(&self) -> Option<DataDir>[src]

Get the parent off a given Data Object Read more

fn basename(&self) -> Option<String>[src]

Get the basename from the Data Object's path (i.e. unix basename) Read more

fn exists(&self) -> Result<bool>[src]

Determine if a file or directory exists for a particular data URI Read more

impl From<DataObject> for DataDir[src]

Auto Trait Implementations

impl Send for DataDir

impl Sync for DataDir

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Same for T

type Output = T

Should always be Self

impl<T> Erased for T