pub struct CommandResult {
pub success: bool,
pub data: Option<Value>,
pub error: Option<String>,
pub exit_code: Option<i32>,
pub stdout: Option<String>,
pub stderr: Option<String>,
pub duration_ms: Option<u64>,
pub json_log_location: Option<String>,
}Expand description
Result from executing a command
Fields§
§success: boolWhether the command succeeded
data: Option<Value>The output data from the command
error: Option<String>Error message if the command failed
exit_code: Option<i32>Exit code if applicable
stdout: Option<String>Standard output if captured
stderr: Option<String>Standard error if captured
duration_ms: Option<u64>Execution time in milliseconds
json_log_location: Option<String>Claude JSON log location for observability
Implementations§
Source§impl CommandResult
impl CommandResult
Sourcepub fn from_output(stdout: String, stderr: String, exit_code: i32) -> Self
pub fn from_output(stdout: String, stderr: String, exit_code: i32) -> Self
Creates a result from command output
Sourcepub fn with_duration(self, duration_ms: u64) -> Self
pub fn with_duration(self, duration_ms: u64) -> Self
Sets the execution duration
Sourcepub fn with_json_log_location(self, location: String) -> Self
pub fn with_json_log_location(self, location: String) -> Self
Sets the Claude JSON log location
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Checks if the result indicates success
Sourcepub fn error_message(&self) -> Option<&str>
pub fn error_message(&self) -> Option<&str>
Gets the error message if present
Sourcepub fn to_result(self) -> Result<Value, CommandError>
pub fn to_result(self) -> Result<Value, CommandError>
Converts to a Result type
Trait Implementations§
Source§impl Clone for CommandResult
impl Clone for CommandResult
Source§fn clone(&self) -> CommandResult
fn clone(&self) -> CommandResult
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 CommandResult
impl Debug for CommandResult
Source§impl<'de> Deserialize<'de> for CommandResult
impl<'de> Deserialize<'de> for CommandResult
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CommandResult
impl RefUnwindSafe for CommandResult
impl Send for CommandResult
impl Sync for CommandResult
impl Unpin for CommandResult
impl UnwindSafe for CommandResult
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