[−][src]Struct gwasm_api::task::TaskBuilder
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::try_new(&workspace, binary).unwrap().build(); assert!(task.is_ok()); assert!(task.unwrap().options().subtasks().next().is_none());
Implementations
impl<'a> TaskBuilder<'a>
[src]
pub fn new<P: AsRef<Path>>(workspace: P, binary: GWasmBinary<'a>) -> Self
[src]
Use try_new instead, which properly handles relative paths
Creates new TaskBuilder
from workspace Path
and GWasmBinary
pub fn try_new<P: AsRef<Path>>(
workspace: P,
binary: GWasmBinary<'a>
) -> Result<Self>
[src]
workspace: P,
binary: GWasmBinary<'a>
) -> Result<Self>
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
Each pushed chunk of data
will be a separate subtask that
will be executed on Golem Network.
To learn how to access the input data, consult the
general crate docs.
pub fn build(self) -> Result<Task>
[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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,