pub struct ScriptingToolSetBuilder { /* private fields */ }Expand description
Builder for ScriptingToolSet.
use bashkit_scripted_tool::{ScriptingToolSet, ToolArgs, ToolDef};
let toolset = ScriptingToolSet::builder("api")
.short_description("Example API")
.tool_fn(
ToolDef::new("ping", "Ping a host"),
|_args: &ToolArgs| Ok("pong\n".to_string()),
)
.build();Implementations§
Source§impl ScriptingToolSetBuilder
impl ScriptingToolSetBuilder
Sourcepub fn locale(self, locale: &str) -> Self
pub fn locale(self, locale: &str) -> Self
Set locale for descriptions, help, prompts, and user-facing errors.
Sourcepub fn short_description(self, desc: impl Into<String>) -> Self
pub fn short_description(self, desc: impl Into<String>) -> Self
One-line description for tool listings.
Sourcepub fn tool_fn(
self,
def: ToolDef,
exec: impl Fn(&ToolArgs) -> Result<String, String> + Send + Sync + 'static,
) -> Self
pub fn tool_fn( self, def: ToolDef, exec: impl Fn(&ToolArgs) -> Result<String, String> + Send + Sync + 'static, ) -> Self
Register a tool with its definition and synchronous exec function.
Convenience shorthand — constructs a ToolImpl internally.
Sourcepub fn async_tool_fn<F, Fut>(self, def: ToolDef, exec: F) -> Self
pub fn async_tool_fn<F, Fut>(self, def: ToolDef, exec: F) -> Self
Register a tool with its definition and async exec function.
Convenience shorthand — constructs a ToolImpl internally.
Sourcepub fn limits(self, limits: ExecutionLimits) -> Self
pub fn limits(self, limits: ExecutionLimits) -> Self
Set execution limits for the bash interpreter.
Sourcepub fn profile(self, profile: ExecutionProfile) -> Self
pub fn profile(self, profile: ExecutionProfile) -> Self
Apply a coherent execution profile to the inner scripted tool.
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 visible inside scripts.
Sourcepub fn with_discovery(self) -> Self
pub fn with_discovery(self) -> Self
Switch to discovery mode: returns two tools from ScriptingToolSet::tools.
Sourcepub fn build(&self) -> ScriptingToolSet
pub fn build(&self) -> ScriptingToolSet
Build the ScriptingToolSet.
Auto Trait Implementations§
impl !RefUnwindSafe for ScriptingToolSetBuilder
impl !UnwindSafe for ScriptingToolSetBuilder
impl Freeze for ScriptingToolSetBuilder
impl Send for ScriptingToolSetBuilder
impl Sync for ScriptingToolSetBuilder
impl Unpin for ScriptingToolSetBuilder
impl UnsafeUnpin for ScriptingToolSetBuilder
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