pub struct ClaudeBuilder { /* private fields */ }Expand description
Implementations§
Source§impl ClaudeBuilder
impl ClaudeBuilder
Sourcepub fn binary(self, path: impl Into<PathBuf>) -> Self
pub fn binary(self, path: impl Into<PathBuf>) -> Self
Set the path to the claude binary.
If not set, the binary is resolved from PATH using which.
Sourcepub fn working_dir(self, path: impl Into<PathBuf>) -> Self
pub fn working_dir(self, path: impl Into<PathBuf>) -> Self
Set the working directory for all commands.
The spawned process will use this as its current directory.
Sourcepub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add an environment variable to pass to all commands.
Sourcepub fn envs(
self,
vars: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>,
) -> Self
pub fn envs( self, vars: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>, ) -> Self
Add multiple environment variables.
Sourcepub fn timeout_secs(self, seconds: u64) -> Self
pub fn timeout_secs(self, seconds: u64) -> Self
Set a default timeout for all commands (in seconds).
Sourcepub fn arg(self, arg: impl Into<String>) -> Self
pub fn arg(self, arg: impl Into<String>) -> Self
Add a global argument applied to all commands.
This is an escape hatch for flags not yet covered by the API.
Sourcepub fn color(self, enabled: bool) -> Self
pub fn color(self, enabled: bool) -> Self
Control color output for all commands.
Passes --color when enabled is true, --no-color when false.
Sourcepub fn retry(self, policy: RetryPolicy) -> Self
pub fn retry(self, policy: RetryPolicy) -> Self
Set a default retry policy for all commands.
Individual commands can override this via their own retry settings.
§Example
use claude_wrapper::{Claude, RetryPolicy};
use std::time::Duration;
let claude = Claude::builder()
.retry(RetryPolicy::new()
.max_attempts(3)
.initial_backoff(Duration::from_secs(2))
.exponential()
.retry_on_timeout(true))
.build()?;Trait Implementations§
Source§impl Debug for ClaudeBuilder
impl Debug for ClaudeBuilder
Source§impl Default for ClaudeBuilder
impl Default for ClaudeBuilder
Source§fn default() -> ClaudeBuilder
fn default() -> ClaudeBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ClaudeBuilder
impl RefUnwindSafe for ClaudeBuilder
impl Send for ClaudeBuilder
impl Sync for ClaudeBuilder
impl Unpin for ClaudeBuilder
impl UnsafeUnpin for ClaudeBuilder
impl UnwindSafe for ClaudeBuilder
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