Xenon for Rust

Build Status License: MIT Coverage Status Crates.io

This crate contains Rust bindings to the Xenon middleware (gRPC).

Documentation

Usage

The interface is kept, as much as possible, similar to Xenon's Java API.

```rust use anyhow::Result; use xenon::credentials::Credential; use xenon::storage::{FileSystem, FileSystemPath};

[tokio::main]

async fn main() -> Result<()> { let location = "remote-server:22"; let credential = Credential::newpassword("username", "password"); let xenonendpoint = "http://localhost:50051";

// Create a SFTP connection to the remote location.
let mut filesystem = FileSystem::create(
    "sftp", 
    location, 
    credential, 
    xenon_endpoint, 
    None,
).await?;

// Create a new file, if it not already exists.
let example_file = "./example.txt";
if !filesystem.exists(example_file).await? {
    filesystem.create_file(example_file).await?;
}

// Append some text to the file.
let text = String::from("Hello, world!\n");
filesystem.append_to_file(text, example_file).await?;

// Close the connection.
filesystem.close().await?;

Ok(())

} ```

See the examples directory for more examples.