Struct rain_task::Output[][src]

pub struct Output {
    pub spec: ObjectSpec,
    // some fields omitted
}

One instance of output DataObject.

The output can be either empty (as is initially), set to represent an existing file, set to represent an existing directory, or written to as a Write. These three are mutually exclusive, set_dir_path and set_file_path may be used only once, and not before or after get_writer.

This object is thread-safe and the internal state is guarded by a mutex. Calling get_writer locks this mutex and holds it until the returned guard is dropped. This means fast (lockless) writes to the Write but you need to make sure your other threads do not starve or deadlock.

Fields

The original output description

Methods

impl Output
[src]

Submit the given directory as the output contents. Moves the directory to the staging area. You should make sure no files in the directory are open after this operation.

Panics if the output was submitted to and on I/O errors. Returns an error if the output is not a directory type.

Submit the given file as the output contents. Moves the file to the staging area. You should make sure that the file is not open after this operation.

Panics if the output was submitted or written to and on I/O errors. Returns an error if the output is not a file directory type.

Set the output to a given input data object. No data is copied in this case and the governor is informed of the pass-through. The input must belong to the same task (this is not checked). Not allowed if the output was submitted or written to.

A shorthand to check that the input is a directory.

Returns Err(TaskError) if not a directory.

A shorthand to check that the input is a file or data blob.

Returns Err(TaskError) if not a blob.

Get the content-type of the object.

Returns the type set in the executor if any, or the type in the spec. Returns "" for directories.

Sets the content type of the object.

Returns an error for directories, incompatible content types and if it has been already set.

Sets the info.user[key] to value.

Any old value is overwriten.

If the output is empty or backed by memory, it is converted to a file. Does nothing if already backed by a file. Returns an error for staged files and inputs.

Trait Implementations

impl Debug for Output
[src]

Formats the value using the given formatter. Read more

impl Display for Output
[src]

Formats the value using the given formatter. Read more

impl Write for Output
[src]

Write a buffer into this object, returning how many bytes were written. Read more

Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more

Attempts to write an entire buffer into this write. Read more

Writes a formatted string into this writer, returning any error encountered. Read more

Important traits for &'a mut R

Creates a "by reference" adaptor for this instance of Write. Read more

Auto Trait Implementations

impl Send for Output

impl Sync for Output