pub struct MountedBinaryResult {
pub ret_code: i32,
pub error: String,
pub stdout: Vec<u8>,
pub stderr: Vec<u8>,
}
Expand description
Describes result of calling a CLI service.
Fields§
§ret_code: i32
Return process exit code or host execution error code, where SUCCESS_CODE means success.
error: String
Contains the string representation of an error, if ret_code != SUCCESS_CODE.
stdout: Vec<u8>
The data that the process wrote to stdout.
stderr: Vec<u8>
The data that the process wrote to stderr.
Implementations§
Source§impl MountedBinaryResult
impl MountedBinaryResult
Sourcepub fn from_error(ret_code: i32, error: impl Into<String>) -> Self
pub fn from_error(ret_code: i32, error: impl Into<String>) -> Self
Create a new failure MountedBinaryResult from the provided ret_code.
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Return true, if this Result represents a success result, otherwise false.
Sourcepub fn into_std(self) -> Option<Result<String, String>>
pub fn into_std(self) -> Option<Result<String, String>>
This function tries to transform a result to the string representation. Internally, It checks ret_code and returns either Some(Ok(stdout)) if it was SUCCESS_CODE or Some(Err(error)) otherwise. None is returned if stdout or stderr contains non valid UTF8 string.
Sourcepub fn as_std(&self) -> Option<Result<String, String>>
pub fn as_std(&self) -> Option<Result<String, String>>
This function tries to represent a result as a string. Internally, It checks ret_code and returns either Some(Ok(stdout)) if it was SUCCESS_CODE or Some(Err(error)) otherwise. None is returned if stdout or stderr contains non valid UTF8 string.
pub fn stringify(&self) -> Option<MountedBinaryStringResult>
Trait Implementations§
Source§impl Clone for MountedBinaryResult
impl Clone for MountedBinaryResult
Source§fn clone(&self) -> MountedBinaryResult
fn clone(&self) -> MountedBinaryResult
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more