Skip to main content

ClaudeConfigBuilder

Struct ClaudeConfigBuilder 

Source
pub struct ClaudeConfigBuilder { /* private fields */ }
Expand description

Builder for ClaudeConfig.

Implementations§

Source§

impl ClaudeConfigBuilder

Source

pub fn preset(self, preset: Preset) -> Self

Sets the preset that determines which CLI flags are auto-injected.

Defaults to Preset::Normal.

Source

pub fn cli_path(self, path: impl Into<String>) -> Self

Sets the path to the claude CLI binary.

When not set, "claude" is resolved via PATH.

Source

pub fn model(self, model: impl Into<String>) -> Self

Sets the model.

Source

pub fn system_prompt(self, prompt: impl Into<String>) -> Self

Sets the system prompt.

Source

pub fn append_system_prompt(self, prompt: impl Into<String>) -> Self

Sets the append system prompt.

Source

pub fn max_turns(self, max_turns: u32) -> Self

Sets the maximum number of turns.

Source

pub fn timeout(self, timeout: Duration) -> Self

Sets the timeout duration.

Source

pub fn stream_idle_timeout(self, timeout: Duration) -> Self

Sets the idle timeout for streams.

If no event arrives within this duration, the stream yields ClaudeError::Timeout and terminates.

Source

pub fn fallback_model(self, model: impl Into<String>) -> Self

Sets the fallback model.

Source

pub fn effort(self, effort: impl Into<String>) -> Self

Sets the effort level. See effort constants for known values.

Source

pub fn max_budget_usd(self, budget: f64) -> Self

Sets the maximum budget in USD.

Source

pub fn allowed_tools( self, tools: impl IntoIterator<Item = impl Into<String>>, ) -> Self

Sets allowed tools (replaces any previous values).

Source

pub fn add_allowed_tool(self, tool: impl Into<String>) -> Self

Adds a single allowed tool.

Source

pub fn disallowed_tools( self, tools: impl IntoIterator<Item = impl Into<String>>, ) -> Self

Sets disallowed tools (replaces any previous values).

Source

pub fn add_disallowed_tool(self, tool: impl Into<String>) -> Self

Adds a single disallowed tool.

Source

pub fn tools(self, tools: impl Into<String>) -> Self

Sets the built-in tool set. "" disables all, "default" enables all.

Source

pub fn mcp_configs( self, configs: impl IntoIterator<Item = impl Into<String>>, ) -> Self

Sets MCP server configs (replaces any previous values).

Source

pub fn add_mcp_config(self, config: impl Into<String>) -> Self

Adds a single MCP server config.

Source

pub fn setting_sources(self, sources: impl Into<String>) -> Self

Sets the setting sources to load.

Source

pub fn settings(self, settings: impl Into<String>) -> Self

Sets the path to a settings file or JSON string.

Source

pub fn json_schema(self, schema: impl Into<String>) -> Self

Sets the JSON Schema for structured output.

Source

pub fn include_partial_messages(self, enabled: bool) -> Self

Enables or disables partial message chunks in stream output.

Source

pub fn include_hook_events(self, enabled: bool) -> Self

Enables or disables hook events in stream output.

Source

pub fn permission_mode(self, mode: impl Into<String>) -> Self

Sets the permission mode. See permission_mode constants for known values.

Source

pub fn dangerously_skip_permissions(self, enabled: bool) -> Self

Enables or disables bypassing all permission checks.

Source

pub fn add_dirs(self, dirs: impl IntoIterator<Item = impl Into<String>>) -> Self

Sets additional directories (replaces any previous values).

Source

pub fn add_dir(self, dir: impl Into<String>) -> Self

Adds a single additional directory.

Source

pub fn files(self, files: impl IntoIterator<Item = impl Into<String>>) -> Self

Sets file resources (replaces any previous values).

Source

pub fn file(self, file: impl Into<String>) -> Self

Adds a single file resource.

Source

pub fn resume(self, session_id: impl Into<String>) -> Self

Sets the session ID to resume.

Source

pub fn session_id(self, id: impl Into<String>) -> Self

Sets a specific session ID.

Source

pub fn bare(self, enabled: bool) -> Self

Enables or disables bare/minimal mode.

Source

pub fn no_session_persistence(self, enabled: bool) -> Self

Enables or disables session persistence. Enabled by default; set to false to allow session persistence.

Source

pub fn disable_slash_commands(self, enabled: bool) -> Self

Enables or disables slash commands. Disabled by default; set to false to enable slash commands.

Source

pub fn strict_mcp_config(self, enabled: bool) -> Self

Enables or disables strict MCP config mode. Enabled by default; set to false to allow non---mcp-config MCP servers.

Source

pub fn extra_args( self, args: impl IntoIterator<Item = impl Into<String>>, ) -> Self

Sets arbitrary extra CLI arguments (replaces any previous values).

These are appended before the prompt. Use typed fields when available; duplicating a typed field here may cause unpredictable CLI behavior.

Source

pub fn add_extra_arg(self, arg: impl Into<String>) -> Self

Adds a single extra CLI argument.

Source

pub fn build(self) -> ClaudeConfig

Builds the ClaudeConfig.

Trait Implementations§

Source§

impl Clone for ClaudeConfigBuilder

Source§

fn clone(&self) -> ClaudeConfigBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ClaudeConfigBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ClaudeConfigBuilder

Source§

fn default() -> ClaudeConfigBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more