pub struct CodeExecutionResult {
pub code: String,
pub stdout: Option<String>,
pub stderr: Option<String>,
pub exit_code: Option<i32>,
pub output_files: Vec<BinaryContent>,
pub error: Option<String>,
}Expand description
Result from code execution.
Fields§
§code: StringThe code that was executed.
stdout: Option<String>Standard output from the execution.
stderr: Option<String>Standard error from the execution.
exit_code: Option<i32>Exit code from the execution.
output_files: Vec<BinaryContent>Any images/files generated by the code.
error: Option<String>Error message if execution failed.
Implementations§
Source§impl CodeExecutionResult
impl CodeExecutionResult
Sourcepub fn new(code: impl Into<String>) -> CodeExecutionResult
pub fn new(code: impl Into<String>) -> CodeExecutionResult
Create a new code execution result.
Sourcepub fn with_stdout(self, stdout: impl Into<String>) -> CodeExecutionResult
pub fn with_stdout(self, stdout: impl Into<String>) -> CodeExecutionResult
Set the stdout.
Sourcepub fn with_stderr(self, stderr: impl Into<String>) -> CodeExecutionResult
pub fn with_stderr(self, stderr: impl Into<String>) -> CodeExecutionResult
Set the stderr.
Sourcepub fn with_exit_code(self, code: i32) -> CodeExecutionResult
pub fn with_exit_code(self, code: i32) -> CodeExecutionResult
Set the exit code.
Sourcepub fn with_output_file(self, file: BinaryContent) -> CodeExecutionResult
pub fn with_output_file(self, file: BinaryContent) -> CodeExecutionResult
Add an output file.
Sourcepub fn with_error(self, error: impl Into<String>) -> CodeExecutionResult
pub fn with_error(self, error: impl Into<String>) -> CodeExecutionResult
Set the error message.
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Check if execution succeeded (exit_code == 0 and no error).
Trait Implementations§
Source§impl Clone for CodeExecutionResult
impl Clone for CodeExecutionResult
Source§fn clone(&self) -> CodeExecutionResult
fn clone(&self) -> CodeExecutionResult
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CodeExecutionResult
impl Debug for CodeExecutionResult
Source§impl<'de> Deserialize<'de> for CodeExecutionResult
impl<'de> Deserialize<'de> for CodeExecutionResult
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CodeExecutionResult, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CodeExecutionResult, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for CodeExecutionResult
impl PartialEq for CodeExecutionResult
Source§impl Serialize for CodeExecutionResult
impl Serialize for CodeExecutionResult
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for CodeExecutionResult
Auto Trait Implementations§
impl Freeze for CodeExecutionResult
impl RefUnwindSafe for CodeExecutionResult
impl Send for CodeExecutionResult
impl Sync for CodeExecutionResult
impl Unpin for CodeExecutionResult
impl UnwindSafe for CodeExecutionResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more