Struct rain_task::DataInstance [−][src]
pub struct DataInstance { pub spec: ObjectSpec, pub info: ObjectInfo, // some fields omitted }
One instance of input DataObject
.
Fields
spec: ObjectSpec
info: ObjectInfo
Methods
impl DataInstance
[src]
impl DataInstance
pub fn get_bytes<'a>(&'a self) -> TaskResult<&'a [u8]>
[src]
pub fn get_bytes<'a>(&'a self) -> TaskResult<&'a [u8]>
Get all the input bytes. In case the input is a file, it is mmap-ed the first time this is called.
Note that every invocation locks the input mutex.
Panics on any I/O error. Returns an error if the input is a directory.
pub fn get_path(&self) -> PathBuf
[src]
pub fn get_path(&self) -> PathBuf
Get the path for the input file. If the input was memory backed, this will write the file to the filesystem the first time this is called. Note that even when written to disk, the data is also still kept in memory.
Note that every invocation locks the input mutex.
pub fn check_directory(&self) -> TaskResult<()>
[src]
pub fn check_directory(&self) -> TaskResult<()>
A shorthand to check that the input is a directory.
Returns Err(TaskError)
if not a directory.
pub fn check_blob(&self) -> TaskResult<()>
[src]
pub fn check_blob(&self) -> TaskResult<()>
A shorthand to check that the input is a file or data blob.
Returns Err(TaskError)
if not a blob.
pub fn get_str<'a>(&'a self) -> TaskResult<&'a str>
[src]
pub fn get_str<'a>(&'a self) -> TaskResult<&'a str>
Panics on any I/O error.
Returns an error if the input is a directory or non-text content-type, or if the input is not valud utf-8. Any other encoding needs to be decoded manually.
Note: checks for valid utf-8 on every call.
pub fn check_content_type(&self, _ctype: &str) -> TaskResult<()>
[src]
pub fn check_content_type(&self, _ctype: &str) -> TaskResult<()>
Check the input content-type.
Return Ok if the actual type is a subtype or supertype of the given type.
pub fn get_content_type(&self) -> String
[src]
pub fn get_content_type(&self) -> String
Get the content-type of the object.
Returns "" for directories.
Trait Implementations
impl Debug for DataInstance
[src]
impl Debug for DataInstance
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Display for DataInstance
[src]
impl Display for DataInstance
Auto Trait Implementations
impl Send for DataInstance
impl Send for DataInstance
impl Sync for DataInstance
impl Sync for DataInstance