[][src]Struct gwasm_api::task::TaskBuilder

pub struct TaskBuilder<'a> { /* fields omitted */ }

gWasm task builder

Note that when build method is executed, the TaskBuilder will be consumed and will generate a Task and a corresponding dir and file structure in the provided workspace Path. For more details about the dir structure, see gWasm docs.

Example:

use gwasm_api::task::{GWasmBinary, TaskBuilder};
use std::path::Path;
use tempfile::tempdir;

let binary = GWasmBinary {
    js: &[],
    wasm: &[],
};
let workspace = tempdir().unwrap();
let task = TaskBuilder::new(&workspace, binary).build();
assert!(task.is_ok());
assert!(task.unwrap().options().subtasks().next().is_none());

Methods

impl<'a> TaskBuilder<'a>[src]

pub fn new<P: AsRef<Path>>(workspace: P, binary: GWasmBinary<'a>) -> Self[src]

Creates new TaskBuilder from workspace Path and GWasmBinary

pub fn name<S: AsRef<str>>(self, name: S) -> Self[src]

Sets task's name

pub fn bid(self, bid: f64) -> Self[src]

Sets task's bid value

pub fn budget(self, budget: f64) -> Self[src]

Sets task's budget value

pub fn timeout(self, timeout: Timeout) -> Self[src]

Sets task's Timeout value

pub fn subtask_timeout(self, subtask_timeout: Timeout) -> Self[src]

Sets subtasks' Timeout value

pub fn output_path<P: AsRef<Path>>(self, output_path: P) -> Self[src]

Sets task's expected output path, i.e., where the final result of the task is meant to land

pub fn push_subtask_data<T: Into<Vec<u8>>>(self, data: T) -> Self[src]

Pushes subtask data into the buffer

Note that each pushed chunk of data is equivalent to one subtask that will be executed on Golem Network.

pub fn build(self) -> Result<Task, Error>[src]

Consumes this builder and creates a Task

Note that when this method is executed, a corresponding dir and file structure in the provided workspace Path. For more details about the dir structure, see gWasm docs.

Trait Implementations

impl<'a> Debug for TaskBuilder<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for TaskBuilder<'a>

impl<'a> Send for TaskBuilder<'a>

impl<'a> Sync for TaskBuilder<'a>

impl<'a> Unpin for TaskBuilder<'a>

impl<'a> UnwindSafe for TaskBuilder<'a>

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,