Skip to main content

BioLibApp

Struct BioLibApp 

Source
pub struct BioLibApp { /* private fields */ }

Implementations§

Source§

impl BioLibApp

Source

pub fn load(uri: &str) -> Result<Self>

Source

pub fn load_with_client(uri: &str, api_client: ApiClient) -> Result<Self>

Source

pub fn uri(&self) -> &str

Examples found in repository?
examples/run_app.rs (line 5)
3fn main() {
4    let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
5    println!("Loaded app: {}", app.uri());
6
7    let mut job = app.cli(None, None, None, true).expect("Failed to run app");
8
9    let exit_code = job.get_exit_code().expect("Failed to get exit code");
10    let stdout = job.get_stdout().expect("Failed to get stdout");
11    let stderr = job.get_stderr().expect("Failed to get stderr");
12
13    println!("Exit code: {exit_code}");
14    println!("Stdout: {}", String::from_utf8_lossy(&stdout));
15    if !stderr.is_empty() {
16        eprintln!("Stderr: {}", String::from_utf8_lossy(&stderr));
17    }
18
19    let files = job.list_output_files().expect("Failed to list files");
20    for file in &files {
21        println!("Output file: {}", file.path);
22    }
23}
Source

pub fn uuid(&self) -> &str

Source

pub fn version(&self) -> &AppVersion

Source

pub fn cli( &self, args: Option<Vec<String>>, stdin: Option<Vec<u8>>, files: Option<HashMap<String, Vec<u8>>>, blocking: bool, ) -> Result<Job>

Examples found in repository?
examples/run_app.rs (line 7)
3fn main() {
4    let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
5    println!("Loaded app: {}", app.uri());
6
7    let mut job = app.cli(None, None, None, true).expect("Failed to run app");
8
9    let exit_code = job.get_exit_code().expect("Failed to get exit code");
10    let stdout = job.get_stdout().expect("Failed to get stdout");
11    let stderr = job.get_stderr().expect("Failed to get stderr");
12
13    println!("Exit code: {exit_code}");
14    println!("Stdout: {}", String::from_utf8_lossy(&stdout));
15    if !stderr.is_empty() {
16        eprintln!("Stderr: {}", String::from_utf8_lossy(&stderr));
17    }
18
19    let files = job.list_output_files().expect("Failed to list files");
20    for file in &files {
21        println!("Output file: {}", file.path);
22    }
23}
24
25fn _example_with_args() {
26    let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
27
28    let args = vec!["--name".to_string(), "World".to_string()];
29    let mut job = app
30        .cli(Some(args), None, None, true)
31        .expect("Failed to run app");
32
33    println!(
34        "Stdout: {}",
35        String::from_utf8_lossy(&job.get_stdout().unwrap())
36    );
37}
38
39fn _example_with_files() {
40    let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
41
42    let mut files = HashMap::new();
43    files.insert("input.txt".to_string(), b"Hello from file".to_vec());
44
45    let mut job = app
46        .cli(None, None, Some(files), true)
47        .expect("Failed to run app");
48
49    let exit_code = job.get_exit_code().unwrap();
50    println!("Exit code: {exit_code}");
51
52    job.save_files("output_dir", true)
53        .expect("Failed to save files");
54}
55
56fn _example_search() {
57    let results = biolib::search(Some("hello"), None, 5).expect("Search failed");
58    for uri in &results {
59        println!("Found: {uri}");
60    }
61}
62
63fn _example_get_result() {
64    let job_id = "some-job-uuid";
65    let mut job = biolib::get_result(job_id, None).expect("Failed to get result");
66
67    let stdout = job.get_stdout().expect("Failed to get stdout");
68    println!("Stdout: {}", String::from_utf8_lossy(&stdout));
69}
70
71fn _example_non_blocking() {
72    let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
73
74    let mut job = app
75        .cli(None, None, None, false)
76        .expect("Failed to start job");
77
78    println!("Job ID: {}", job.id());
79    println!("Share link: {}", job.get_shareable_link());
80
81    job.wait(None).expect("Failed to wait for job");
82
83    let exit_code = job.get_exit_code().unwrap();
84    println!("Exit code: {exit_code}");
85}

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.