[][src]Struct algorithmia::data::DataFile

pub struct DataFile { /* fields omitted */ }

Algorithmia data file

Methods

impl DataFile[src]

pub fn put<B>(&self, body: B) -> Result<()> where
    B: Into<Body>, 
[src]

Write to the Algorithmia Data API

Examples

let client = Algorithmia::client("111112222233333444445555566")?;

client.file(".my/my_dir/string.txt").put("file_contents")?;
client.file(".my/my_dir/bytes.txt").put("file_contents".as_bytes())?;

let file = File::open("/path/to/file.jpg")?;
client.file(".my/my_dir/file.jpg").put(file)?;

pub fn get(&self) -> Result<FileData>[src]

Get a file from the Algorithmia Data API

Examples

let client = Algorithmia::client("111112222233333444445555566")?;
let my_file = client.file(".my/my_dir/sample.txt");

let data = my_file.get()?.into_string()?;

pub fn delete(&self) -> Result<()>[src]

Delete a file from from the Algorithmia Data API

Examples

let client = Algorithmia::client("111112222233333444445555566")?;
let my_file = client.file(".my/my_dir/sample.txt");

match my_file.delete() {
  Ok(_) => println!("Successfully deleted file"),
  Err(err) => println!("Error deleting file: {}", err),
};

Trait Implementations

impl HasDataPath for DataFile[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 DataFile[src]

Auto Trait Implementations

impl Send for DataFile

impl Sync for DataFile

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