ConfigBuilder

Struct ConfigBuilder 

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

A builder for creating configurations with a fluent API.

ImplementationsΒ§

SourceΒ§

impl ConfigBuilder

Source

pub fn new() -> Self

Creates a new configuration builder with default values.

Source

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

Sets the model name.

Source

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

Shorthand: set model with β€˜m’

Examples found in repository?
examples/ultra_simple.rs (line 36)
9async fn main() -> helios_engine::Result<()> {
10    println!("πŸš€ Ultra Simple Helios Example\n");
11
12    // ========== SIMPLEST AGENT CREATION ==========
13    println!("1️⃣  Creating an agent - shortest possible syntax:\n");
14
15    // One-liner: Create agent with auto config
16    let mut agent = Agent::builder("Helper")
17        .auto_config()
18        .prompt("You are helpful and concise.")
19        .build()
20        .await?;
21
22    println!("βœ“ Agent created!\n");
23
24    // ========== SIMPLEST CHAT ==========
25    println!("2️⃣  Asking questions - simplest possible:\n");
26
27    // Use .ask() instead of .chat() for more natural syntax
28    let answer = agent.ask("What is 2+2?").await?;
29    println!("Q: What is 2+2?\nA: {}\n", answer);
30
31    // ========== SIMPLEST CONFIG ==========
32    println!("3️⃣  Creating config with shortest syntax:\n");
33
34    // Ultra-short config creation
35    let _config = Config::builder()
36        .m("gpt-4") // .m() is shorthand for .model()
37        .key("your-api-key") // .key() is shorthand for .api_key()
38        .temp(0.8) // .temp() is shorthand for .temperature()
39        .tokens(1024) // .tokens() is shorthand for .max_tokens()
40        .build();
41
42    println!("βœ“ Config created with ultra-short syntax!\n");
43
44    // ========== SIMPLEST AGENT WITH TOOLS ==========
45    println!("4️⃣  Agent with tools - simplest way:\n");
46
47    let mut calc_agent = Agent::builder("Calculator")
48        .auto_config()
49        .prompt("You are a math expert.")
50        .with_tool(Box::new(CalculatorTool)) // Add single tool
51        .build()
52        .await?;
53
54    let result = calc_agent.ask("Calculate 15 * 7 + 5").await?;
55    println!("Q: Calculate 15 * 7 + 5\nA: {}\n", result);
56
57    // ========== SIMPLEST QUICK AGENT ==========
58    println!("5️⃣  Quick agent - one method call:\n");
59
60    // Agent::quick() creates agent in ONE LINE with auto config!
61    let mut quick_agent = Agent::quick("QuickBot").await?;
62    let quick_answer = quick_agent.ask("Say hello!").await?;
63    println!("Response: {}\n", quick_answer);
64
65    // ========== SIMPLEST CHAT MESSAGES ==========
66    println!("6️⃣  Creating messages - super short syntax:\n");
67
68    use helios_engine::ChatMessage;
69
70    // Short aliases for message creation
71    let _sys_msg = ChatMessage::sys("You are helpful"); // .sys() not .system()
72    let _user_msg = ChatMessage::msg("Hello there"); // .msg() not .user()
73    let _reply_msg = ChatMessage::reply("Hi! How can I help?"); // .reply() not .assistant()
74
75    println!("βœ“ Messages created with ultra-short syntax!\n");
76
77    // ========== SHORTEST AUTOFOREST ==========
78    println!("7️⃣  AutoForest - simplest multi-agent orchestration:\n");
79
80    use helios_engine::AutoForest;
81
82    let mut forest = AutoForest::new(Config::builder().m("gpt-4").build())
83        .with_tools(vec![Box::new(CalculatorTool)])
84        .build()
85        .await?;
86
87    // Use .run() for shortest syntax
88    let forest_result = forest.run("Analyze these numbers: 10, 20, 30, 40").await?;
89    println!("Forest Result:\n{}\n", forest_result);
90
91    // ========== COMPARISON TABLE ==========
92    println!("πŸ“Š Syntax Comparison - Short vs Long:\n");
93    println!("β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”");
94    println!("β”‚ Operation           β”‚ Short Syntax         β”‚ Long Syntax      β”‚");
95    println!("β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€");
96    println!("β”‚ Create Agent        β”‚ Agent::quick()       β”‚ Agent::builder()β”‚");
97    println!("β”‚ Ask Question        β”‚ .ask()               β”‚ .chat()          β”‚");
98    println!("β”‚ System Prompt       β”‚ .prompt()            β”‚ .system_prompt() β”‚");
99    println!("β”‚ Config Model        β”‚ .m()                 β”‚ .model()         β”‚");
100    println!("β”‚ Config Key          β”‚ .key()               β”‚ .api_key()       β”‚");
101    println!("β”‚ Config Temp         β”‚ .temp()              β”‚ .temperature()   β”‚");
102    println!("β”‚ Config Tokens       β”‚ .tokens()            β”‚ .max_tokens()    β”‚");
103    println!("β”‚ System Message      β”‚ ChatMessage::sys()   β”‚ ChatMessage::system()");
104    println!("β”‚ User Message        β”‚ ChatMessage::msg()   β”‚ ChatMessage::user()");
105    println!("β”‚ Assistant Message   β”‚ ChatMessage::reply() β”‚ ChatMessage::assistant()");
106    println!("β”‚ AutoForest Execute  β”‚ .run()               β”‚ .execute_task()  β”‚");
107    println!("β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜\n");
108
109    println!("βœ… All examples completed!");
110    println!("πŸ’‘ Tip: Mix and match short and long syntax based on your preference!");
111
112    Ok(())
113}
Source

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

Sets the API key.

Source

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

Shorthand: set API key with β€˜key’

Examples found in repository?
examples/ultra_simple.rs (line 37)
9async fn main() -> helios_engine::Result<()> {
10    println!("πŸš€ Ultra Simple Helios Example\n");
11
12    // ========== SIMPLEST AGENT CREATION ==========
13    println!("1️⃣  Creating an agent - shortest possible syntax:\n");
14
15    // One-liner: Create agent with auto config
16    let mut agent = Agent::builder("Helper")
17        .auto_config()
18        .prompt("You are helpful and concise.")
19        .build()
20        .await?;
21
22    println!("βœ“ Agent created!\n");
23
24    // ========== SIMPLEST CHAT ==========
25    println!("2️⃣  Asking questions - simplest possible:\n");
26
27    // Use .ask() instead of .chat() for more natural syntax
28    let answer = agent.ask("What is 2+2?").await?;
29    println!("Q: What is 2+2?\nA: {}\n", answer);
30
31    // ========== SIMPLEST CONFIG ==========
32    println!("3️⃣  Creating config with shortest syntax:\n");
33
34    // Ultra-short config creation
35    let _config = Config::builder()
36        .m("gpt-4") // .m() is shorthand for .model()
37        .key("your-api-key") // .key() is shorthand for .api_key()
38        .temp(0.8) // .temp() is shorthand for .temperature()
39        .tokens(1024) // .tokens() is shorthand for .max_tokens()
40        .build();
41
42    println!("βœ“ Config created with ultra-short syntax!\n");
43
44    // ========== SIMPLEST AGENT WITH TOOLS ==========
45    println!("4️⃣  Agent with tools - simplest way:\n");
46
47    let mut calc_agent = Agent::builder("Calculator")
48        .auto_config()
49        .prompt("You are a math expert.")
50        .with_tool(Box::new(CalculatorTool)) // Add single tool
51        .build()
52        .await?;
53
54    let result = calc_agent.ask("Calculate 15 * 7 + 5").await?;
55    println!("Q: Calculate 15 * 7 + 5\nA: {}\n", result);
56
57    // ========== SIMPLEST QUICK AGENT ==========
58    println!("5️⃣  Quick agent - one method call:\n");
59
60    // Agent::quick() creates agent in ONE LINE with auto config!
61    let mut quick_agent = Agent::quick("QuickBot").await?;
62    let quick_answer = quick_agent.ask("Say hello!").await?;
63    println!("Response: {}\n", quick_answer);
64
65    // ========== SIMPLEST CHAT MESSAGES ==========
66    println!("6️⃣  Creating messages - super short syntax:\n");
67
68    use helios_engine::ChatMessage;
69
70    // Short aliases for message creation
71    let _sys_msg = ChatMessage::sys("You are helpful"); // .sys() not .system()
72    let _user_msg = ChatMessage::msg("Hello there"); // .msg() not .user()
73    let _reply_msg = ChatMessage::reply("Hi! How can I help?"); // .reply() not .assistant()
74
75    println!("βœ“ Messages created with ultra-short syntax!\n");
76
77    // ========== SHORTEST AUTOFOREST ==========
78    println!("7️⃣  AutoForest - simplest multi-agent orchestration:\n");
79
80    use helios_engine::AutoForest;
81
82    let mut forest = AutoForest::new(Config::builder().m("gpt-4").build())
83        .with_tools(vec![Box::new(CalculatorTool)])
84        .build()
85        .await?;
86
87    // Use .run() for shortest syntax
88    let forest_result = forest.run("Analyze these numbers: 10, 20, 30, 40").await?;
89    println!("Forest Result:\n{}\n", forest_result);
90
91    // ========== COMPARISON TABLE ==========
92    println!("πŸ“Š Syntax Comparison - Short vs Long:\n");
93    println!("β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”");
94    println!("β”‚ Operation           β”‚ Short Syntax         β”‚ Long Syntax      β”‚");
95    println!("β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€");
96    println!("β”‚ Create Agent        β”‚ Agent::quick()       β”‚ Agent::builder()β”‚");
97    println!("β”‚ Ask Question        β”‚ .ask()               β”‚ .chat()          β”‚");
98    println!("β”‚ System Prompt       β”‚ .prompt()            β”‚ .system_prompt() β”‚");
99    println!("β”‚ Config Model        β”‚ .m()                 β”‚ .model()         β”‚");
100    println!("β”‚ Config Key          β”‚ .key()               β”‚ .api_key()       β”‚");
101    println!("β”‚ Config Temp         β”‚ .temp()              β”‚ .temperature()   β”‚");
102    println!("β”‚ Config Tokens       β”‚ .tokens()            β”‚ .max_tokens()    β”‚");
103    println!("β”‚ System Message      β”‚ ChatMessage::sys()   β”‚ ChatMessage::system()");
104    println!("β”‚ User Message        β”‚ ChatMessage::msg()   β”‚ ChatMessage::user()");
105    println!("β”‚ Assistant Message   β”‚ ChatMessage::reply() β”‚ ChatMessage::assistant()");
106    println!("β”‚ AutoForest Execute  β”‚ .run()               β”‚ .execute_task()  β”‚");
107    println!("β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜\n");
108
109    println!("βœ… All examples completed!");
110    println!("πŸ’‘ Tip: Mix and match short and long syntax based on your preference!");
111
112    Ok(())
113}
Source

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

Sets the base URL for the API.

Source

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

Shorthand: set base URL with β€˜url’

Source

pub fn temperature(self, temp: f32) -> Self

Sets the temperature for generation.

Examples found in repository?
examples/auto_forest_demo.rs (line 21)
15async fn main() -> helios_engine::Result<()> {
16    println!("🌲 AutoForest - Intelligent Agent Orchestration Demo\n");
17    println!("====================================================\n");
18
19    // Step 1: Load or create configuration
20    println!("πŸ“‹ Creating configuration...");
21    let config = Config::builder().temperature(0.7).max_tokens(2048).build();
22    println!("βœ“ Configuration ready\n");
23
24    // Step 2: Create AutoForest with available tools
25    println!("πŸ”§ Initializing AutoForest with tools...");
26    let mut auto_forest = AutoForest::new(config)
27        .with_tools(vec![
28            Box::new(CalculatorTool),
29            // Additional tools could be added here
30        ])
31        .build()
32        .await?;
33    println!("βœ“ AutoForest initialized\n");
34
35    // Step 3: Define a complex task
36    let task = r#"
37    I need to analyze a business problem:
38    1. A company has Q3 revenue data showing mixed results across 5 product categories
39    2. I need to understand which categories are underperforming
40    3. Calculate the performance metrics for each category
41    4. Identify trends and predict Q4 performance
42    5. Recommend which categories need attention
43    "#;
44
45    println!("πŸ“ Submitting task to AutoForest...");
46    println!("Task: {}\n", task.trim());
47
48    // Step 4: Execute the task
49    println!("πŸš€ AutoForest is orchestrating agent deployment...\n");
50    let result = auto_forest.execute_task(task).await?;
51
52    // Step 5: Display the orchestration plan
53    println!("πŸ“Š Orchestration Plan Generated:");
54    println!("================================\n");
55
56    if let Some(plan) = auto_forest.orchestration_plan() {
57        println!("Task: {}", plan.task.trim());
58        println!("Number of Agents Spawned: {}", plan.num_agents);
59        println!("Planning Reasoning: {}\n", plan.reasoning);
60
61        println!("Agent Configurations:");
62        println!("-----------------");
63        for (i, agent_config) in plan.agents.iter().enumerate() {
64            println!(
65                "Agent {}: {} ({})",
66                i + 1,
67                agent_config.name,
68                agent_config.role
69            );
70            println!("  Prompt: {}", agent_config.system_prompt);
71            if !agent_config.tool_indices.is_empty() {
72                println!("  Tools: {:?}", agent_config.tool_indices);
73            }
74            println!();
75        }
76
77        println!("Task Breakdown:");
78        println!("--------------");
79        for (agent_name, subtask) in &plan.task_breakdown {
80            println!("β€’ {} β†’ {}", agent_name, subtask);
81        }
82        println!();
83    }
84
85    // Step 6: Display spawned agents
86    println!("πŸ€– Spawned Agents:");
87    println!("-----------------");
88    let spawned = auto_forest.spawned_agents();
89    println!("Total agents created: {}\n", spawned.len());
90
91    for (i, spawned_agent) in spawned.iter().enumerate() {
92        println!("Agent {}: {}", i + 1, spawned_agent.config.name);
93        println!("  Role: {}", spawned_agent.config.role);
94        if let Some(result) = &spawned_agent.result {
95            println!("  Result available: Yes ({} chars)", result.len());
96        } else {
97            println!("  Result: Pending");
98        }
99        println!();
100    }
101
102    // Step 7: Display the final synthesized result
103    println!("πŸ“ˆ Final Synthesized Result:");
104    println!("==========================\n");
105    println!("{}\n", result);
106
107    // Step 8: Demonstrate a second task with different complexity
108    println!("\nπŸ”„ Executing a second task with different complexity...\n");
109
110    let simple_task = "Calculate the average of these numbers: 100, 200, 300, 400, 500. Then tell me what percentage each is of the total.";
111
112    println!("Task: {}\n", simple_task);
113    println!("πŸš€ Processing...\n");
114
115    let result2 = auto_forest.execute_task(simple_task).await?;
116
117    println!("Result:\n{}\n", result2);
118
119    if let Some(plan) = auto_forest.orchestration_plan() {
120        println!(
121            "This task resulted in {} agent(s) - a simpler orchestration plan.",
122            plan.num_agents
123        );
124        println!("Reasoning: {}\n", plan.reasoning);
125    }
126
127    println!("βœ… AutoForest demo completed!");
128    println!("=============================");
129    println!("\nπŸ’‘ Key Features Demonstrated:");
130    println!("  β€’ Automatic agent spawning based on task complexity");
131    println!("  β€’ Specialized agent prompt generation");
132    println!("  β€’ Task breakdown across agents");
133    println!("  β€’ Result aggregation and synthesis");
134    println!("  β€’ Flexible orchestration for varying task complexity");
135
136    Ok(())
137}
Source

pub fn temp(self, temp: f32) -> Self

Shorthand: set temperature with β€˜temp’

Examples found in repository?
examples/ultra_simple.rs (line 38)
9async fn main() -> helios_engine::Result<()> {
10    println!("πŸš€ Ultra Simple Helios Example\n");
11
12    // ========== SIMPLEST AGENT CREATION ==========
13    println!("1️⃣  Creating an agent - shortest possible syntax:\n");
14
15    // One-liner: Create agent with auto config
16    let mut agent = Agent::builder("Helper")
17        .auto_config()
18        .prompt("You are helpful and concise.")
19        .build()
20        .await?;
21
22    println!("βœ“ Agent created!\n");
23
24    // ========== SIMPLEST CHAT ==========
25    println!("2️⃣  Asking questions - simplest possible:\n");
26
27    // Use .ask() instead of .chat() for more natural syntax
28    let answer = agent.ask("What is 2+2?").await?;
29    println!("Q: What is 2+2?\nA: {}\n", answer);
30
31    // ========== SIMPLEST CONFIG ==========
32    println!("3️⃣  Creating config with shortest syntax:\n");
33
34    // Ultra-short config creation
35    let _config = Config::builder()
36        .m("gpt-4") // .m() is shorthand for .model()
37        .key("your-api-key") // .key() is shorthand for .api_key()
38        .temp(0.8) // .temp() is shorthand for .temperature()
39        .tokens(1024) // .tokens() is shorthand for .max_tokens()
40        .build();
41
42    println!("βœ“ Config created with ultra-short syntax!\n");
43
44    // ========== SIMPLEST AGENT WITH TOOLS ==========
45    println!("4️⃣  Agent with tools - simplest way:\n");
46
47    let mut calc_agent = Agent::builder("Calculator")
48        .auto_config()
49        .prompt("You are a math expert.")
50        .with_tool(Box::new(CalculatorTool)) // Add single tool
51        .build()
52        .await?;
53
54    let result = calc_agent.ask("Calculate 15 * 7 + 5").await?;
55    println!("Q: Calculate 15 * 7 + 5\nA: {}\n", result);
56
57    // ========== SIMPLEST QUICK AGENT ==========
58    println!("5️⃣  Quick agent - one method call:\n");
59
60    // Agent::quick() creates agent in ONE LINE with auto config!
61    let mut quick_agent = Agent::quick("QuickBot").await?;
62    let quick_answer = quick_agent.ask("Say hello!").await?;
63    println!("Response: {}\n", quick_answer);
64
65    // ========== SIMPLEST CHAT MESSAGES ==========
66    println!("6️⃣  Creating messages - super short syntax:\n");
67
68    use helios_engine::ChatMessage;
69
70    // Short aliases for message creation
71    let _sys_msg = ChatMessage::sys("You are helpful"); // .sys() not .system()
72    let _user_msg = ChatMessage::msg("Hello there"); // .msg() not .user()
73    let _reply_msg = ChatMessage::reply("Hi! How can I help?"); // .reply() not .assistant()
74
75    println!("βœ“ Messages created with ultra-short syntax!\n");
76
77    // ========== SHORTEST AUTOFOREST ==========
78    println!("7️⃣  AutoForest - simplest multi-agent orchestration:\n");
79
80    use helios_engine::AutoForest;
81
82    let mut forest = AutoForest::new(Config::builder().m("gpt-4").build())
83        .with_tools(vec![Box::new(CalculatorTool)])
84        .build()
85        .await?;
86
87    // Use .run() for shortest syntax
88    let forest_result = forest.run("Analyze these numbers: 10, 20, 30, 40").await?;
89    println!("Forest Result:\n{}\n", forest_result);
90
91    // ========== COMPARISON TABLE ==========
92    println!("πŸ“Š Syntax Comparison - Short vs Long:\n");
93    println!("β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”");
94    println!("β”‚ Operation           β”‚ Short Syntax         β”‚ Long Syntax      β”‚");
95    println!("β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€");
96    println!("β”‚ Create Agent        β”‚ Agent::quick()       β”‚ Agent::builder()β”‚");
97    println!("β”‚ Ask Question        β”‚ .ask()               β”‚ .chat()          β”‚");
98    println!("β”‚ System Prompt       β”‚ .prompt()            β”‚ .system_prompt() β”‚");
99    println!("β”‚ Config Model        β”‚ .m()                 β”‚ .model()         β”‚");
100    println!("β”‚ Config Key          β”‚ .key()               β”‚ .api_key()       β”‚");
101    println!("β”‚ Config Temp         β”‚ .temp()              β”‚ .temperature()   β”‚");
102    println!("β”‚ Config Tokens       β”‚ .tokens()            β”‚ .max_tokens()    β”‚");
103    println!("β”‚ System Message      β”‚ ChatMessage::sys()   β”‚ ChatMessage::system()");
104    println!("β”‚ User Message        β”‚ ChatMessage::msg()   β”‚ ChatMessage::user()");
105    println!("β”‚ Assistant Message   β”‚ ChatMessage::reply() β”‚ ChatMessage::assistant()");
106    println!("β”‚ AutoForest Execute  β”‚ .run()               β”‚ .execute_task()  β”‚");
107    println!("β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜\n");
108
109    println!("βœ… All examples completed!");
110    println!("πŸ’‘ Tip: Mix and match short and long syntax based on your preference!");
111
112    Ok(())
113}
Source

pub fn max_tokens(self, tokens: u32) -> Self

Sets the maximum tokens for generation.

Examples found in repository?
examples/auto_forest_demo.rs (line 21)
15async fn main() -> helios_engine::Result<()> {
16    println!("🌲 AutoForest - Intelligent Agent Orchestration Demo\n");
17    println!("====================================================\n");
18
19    // Step 1: Load or create configuration
20    println!("πŸ“‹ Creating configuration...");
21    let config = Config::builder().temperature(0.7).max_tokens(2048).build();
22    println!("βœ“ Configuration ready\n");
23
24    // Step 2: Create AutoForest with available tools
25    println!("πŸ”§ Initializing AutoForest with tools...");
26    let mut auto_forest = AutoForest::new(config)
27        .with_tools(vec![
28            Box::new(CalculatorTool),
29            // Additional tools could be added here
30        ])
31        .build()
32        .await?;
33    println!("βœ“ AutoForest initialized\n");
34
35    // Step 3: Define a complex task
36    let task = r#"
37    I need to analyze a business problem:
38    1. A company has Q3 revenue data showing mixed results across 5 product categories
39    2. I need to understand which categories are underperforming
40    3. Calculate the performance metrics for each category
41    4. Identify trends and predict Q4 performance
42    5. Recommend which categories need attention
43    "#;
44
45    println!("πŸ“ Submitting task to AutoForest...");
46    println!("Task: {}\n", task.trim());
47
48    // Step 4: Execute the task
49    println!("πŸš€ AutoForest is orchestrating agent deployment...\n");
50    let result = auto_forest.execute_task(task).await?;
51
52    // Step 5: Display the orchestration plan
53    println!("πŸ“Š Orchestration Plan Generated:");
54    println!("================================\n");
55
56    if let Some(plan) = auto_forest.orchestration_plan() {
57        println!("Task: {}", plan.task.trim());
58        println!("Number of Agents Spawned: {}", plan.num_agents);
59        println!("Planning Reasoning: {}\n", plan.reasoning);
60
61        println!("Agent Configurations:");
62        println!("-----------------");
63        for (i, agent_config) in plan.agents.iter().enumerate() {
64            println!(
65                "Agent {}: {} ({})",
66                i + 1,
67                agent_config.name,
68                agent_config.role
69            );
70            println!("  Prompt: {}", agent_config.system_prompt);
71            if !agent_config.tool_indices.is_empty() {
72                println!("  Tools: {:?}", agent_config.tool_indices);
73            }
74            println!();
75        }
76
77        println!("Task Breakdown:");
78        println!("--------------");
79        for (agent_name, subtask) in &plan.task_breakdown {
80            println!("β€’ {} β†’ {}", agent_name, subtask);
81        }
82        println!();
83    }
84
85    // Step 6: Display spawned agents
86    println!("πŸ€– Spawned Agents:");
87    println!("-----------------");
88    let spawned = auto_forest.spawned_agents();
89    println!("Total agents created: {}\n", spawned.len());
90
91    for (i, spawned_agent) in spawned.iter().enumerate() {
92        println!("Agent {}: {}", i + 1, spawned_agent.config.name);
93        println!("  Role: {}", spawned_agent.config.role);
94        if let Some(result) = &spawned_agent.result {
95            println!("  Result available: Yes ({} chars)", result.len());
96        } else {
97            println!("  Result: Pending");
98        }
99        println!();
100    }
101
102    // Step 7: Display the final synthesized result
103    println!("πŸ“ˆ Final Synthesized Result:");
104    println!("==========================\n");
105    println!("{}\n", result);
106
107    // Step 8: Demonstrate a second task with different complexity
108    println!("\nπŸ”„ Executing a second task with different complexity...\n");
109
110    let simple_task = "Calculate the average of these numbers: 100, 200, 300, 400, 500. Then tell me what percentage each is of the total.";
111
112    println!("Task: {}\n", simple_task);
113    println!("πŸš€ Processing...\n");
114
115    let result2 = auto_forest.execute_task(simple_task).await?;
116
117    println!("Result:\n{}\n", result2);
118
119    if let Some(plan) = auto_forest.orchestration_plan() {
120        println!(
121            "This task resulted in {} agent(s) - a simpler orchestration plan.",
122            plan.num_agents
123        );
124        println!("Reasoning: {}\n", plan.reasoning);
125    }
126
127    println!("βœ… AutoForest demo completed!");
128    println!("=============================");
129    println!("\nπŸ’‘ Key Features Demonstrated:");
130    println!("  β€’ Automatic agent spawning based on task complexity");
131    println!("  β€’ Specialized agent prompt generation");
132    println!("  β€’ Task breakdown across agents");
133    println!("  β€’ Result aggregation and synthesis");
134    println!("  β€’ Flexible orchestration for varying task complexity");
135
136    Ok(())
137}
Source

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

Shorthand: set max tokens with β€˜tokens’

Examples found in repository?
examples/ultra_simple.rs (line 39)
9async fn main() -> helios_engine::Result<()> {
10    println!("πŸš€ Ultra Simple Helios Example\n");
11
12    // ========== SIMPLEST AGENT CREATION ==========
13    println!("1️⃣  Creating an agent - shortest possible syntax:\n");
14
15    // One-liner: Create agent with auto config
16    let mut agent = Agent::builder("Helper")
17        .auto_config()
18        .prompt("You are helpful and concise.")
19        .build()
20        .await?;
21
22    println!("βœ“ Agent created!\n");
23
24    // ========== SIMPLEST CHAT ==========
25    println!("2️⃣  Asking questions - simplest possible:\n");
26
27    // Use .ask() instead of .chat() for more natural syntax
28    let answer = agent.ask("What is 2+2?").await?;
29    println!("Q: What is 2+2?\nA: {}\n", answer);
30
31    // ========== SIMPLEST CONFIG ==========
32    println!("3️⃣  Creating config with shortest syntax:\n");
33
34    // Ultra-short config creation
35    let _config = Config::builder()
36        .m("gpt-4") // .m() is shorthand for .model()
37        .key("your-api-key") // .key() is shorthand for .api_key()
38        .temp(0.8) // .temp() is shorthand for .temperature()
39        .tokens(1024) // .tokens() is shorthand for .max_tokens()
40        .build();
41
42    println!("βœ“ Config created with ultra-short syntax!\n");
43
44    // ========== SIMPLEST AGENT WITH TOOLS ==========
45    println!("4️⃣  Agent with tools - simplest way:\n");
46
47    let mut calc_agent = Agent::builder("Calculator")
48        .auto_config()
49        .prompt("You are a math expert.")
50        .with_tool(Box::new(CalculatorTool)) // Add single tool
51        .build()
52        .await?;
53
54    let result = calc_agent.ask("Calculate 15 * 7 + 5").await?;
55    println!("Q: Calculate 15 * 7 + 5\nA: {}\n", result);
56
57    // ========== SIMPLEST QUICK AGENT ==========
58    println!("5️⃣  Quick agent - one method call:\n");
59
60    // Agent::quick() creates agent in ONE LINE with auto config!
61    let mut quick_agent = Agent::quick("QuickBot").await?;
62    let quick_answer = quick_agent.ask("Say hello!").await?;
63    println!("Response: {}\n", quick_answer);
64
65    // ========== SIMPLEST CHAT MESSAGES ==========
66    println!("6️⃣  Creating messages - super short syntax:\n");
67
68    use helios_engine::ChatMessage;
69
70    // Short aliases for message creation
71    let _sys_msg = ChatMessage::sys("You are helpful"); // .sys() not .system()
72    let _user_msg = ChatMessage::msg("Hello there"); // .msg() not .user()
73    let _reply_msg = ChatMessage::reply("Hi! How can I help?"); // .reply() not .assistant()
74
75    println!("βœ“ Messages created with ultra-short syntax!\n");
76
77    // ========== SHORTEST AUTOFOREST ==========
78    println!("7️⃣  AutoForest - simplest multi-agent orchestration:\n");
79
80    use helios_engine::AutoForest;
81
82    let mut forest = AutoForest::new(Config::builder().m("gpt-4").build())
83        .with_tools(vec![Box::new(CalculatorTool)])
84        .build()
85        .await?;
86
87    // Use .run() for shortest syntax
88    let forest_result = forest.run("Analyze these numbers: 10, 20, 30, 40").await?;
89    println!("Forest Result:\n{}\n", forest_result);
90
91    // ========== COMPARISON TABLE ==========
92    println!("πŸ“Š Syntax Comparison - Short vs Long:\n");
93    println!("β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”");
94    println!("β”‚ Operation           β”‚ Short Syntax         β”‚ Long Syntax      β”‚");
95    println!("β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€");
96    println!("β”‚ Create Agent        β”‚ Agent::quick()       β”‚ Agent::builder()β”‚");
97    println!("β”‚ Ask Question        β”‚ .ask()               β”‚ .chat()          β”‚");
98    println!("β”‚ System Prompt       β”‚ .prompt()            β”‚ .system_prompt() β”‚");
99    println!("β”‚ Config Model        β”‚ .m()                 β”‚ .model()         β”‚");
100    println!("β”‚ Config Key          β”‚ .key()               β”‚ .api_key()       β”‚");
101    println!("β”‚ Config Temp         β”‚ .temp()              β”‚ .temperature()   β”‚");
102    println!("β”‚ Config Tokens       β”‚ .tokens()            β”‚ .max_tokens()    β”‚");
103    println!("β”‚ System Message      β”‚ ChatMessage::sys()   β”‚ ChatMessage::system()");
104    println!("β”‚ User Message        β”‚ ChatMessage::msg()   β”‚ ChatMessage::user()");
105    println!("β”‚ Assistant Message   β”‚ ChatMessage::reply() β”‚ ChatMessage::assistant()");
106    println!("β”‚ AutoForest Execute  β”‚ .run()               β”‚ .execute_task()  β”‚");
107    println!("β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜\n");
108
109    println!("βœ… All examples completed!");
110    println!("πŸ’‘ Tip: Mix and match short and long syntax based on your preference!");
111
112    Ok(())
113}
Source

pub fn build(self) -> Config

Builds the configuration.

Examples found in repository?
examples/auto_forest_demo.rs (line 21)
15async fn main() -> helios_engine::Result<()> {
16    println!("🌲 AutoForest - Intelligent Agent Orchestration Demo\n");
17    println!("====================================================\n");
18
19    // Step 1: Load or create configuration
20    println!("πŸ“‹ Creating configuration...");
21    let config = Config::builder().temperature(0.7).max_tokens(2048).build();
22    println!("βœ“ Configuration ready\n");
23
24    // Step 2: Create AutoForest with available tools
25    println!("πŸ”§ Initializing AutoForest with tools...");
26    let mut auto_forest = AutoForest::new(config)
27        .with_tools(vec![
28            Box::new(CalculatorTool),
29            // Additional tools could be added here
30        ])
31        .build()
32        .await?;
33    println!("βœ“ AutoForest initialized\n");
34
35    // Step 3: Define a complex task
36    let task = r#"
37    I need to analyze a business problem:
38    1. A company has Q3 revenue data showing mixed results across 5 product categories
39    2. I need to understand which categories are underperforming
40    3. Calculate the performance metrics for each category
41    4. Identify trends and predict Q4 performance
42    5. Recommend which categories need attention
43    "#;
44
45    println!("πŸ“ Submitting task to AutoForest...");
46    println!("Task: {}\n", task.trim());
47
48    // Step 4: Execute the task
49    println!("πŸš€ AutoForest is orchestrating agent deployment...\n");
50    let result = auto_forest.execute_task(task).await?;
51
52    // Step 5: Display the orchestration plan
53    println!("πŸ“Š Orchestration Plan Generated:");
54    println!("================================\n");
55
56    if let Some(plan) = auto_forest.orchestration_plan() {
57        println!("Task: {}", plan.task.trim());
58        println!("Number of Agents Spawned: {}", plan.num_agents);
59        println!("Planning Reasoning: {}\n", plan.reasoning);
60
61        println!("Agent Configurations:");
62        println!("-----------------");
63        for (i, agent_config) in plan.agents.iter().enumerate() {
64            println!(
65                "Agent {}: {} ({})",
66                i + 1,
67                agent_config.name,
68                agent_config.role
69            );
70            println!("  Prompt: {}", agent_config.system_prompt);
71            if !agent_config.tool_indices.is_empty() {
72                println!("  Tools: {:?}", agent_config.tool_indices);
73            }
74            println!();
75        }
76
77        println!("Task Breakdown:");
78        println!("--------------");
79        for (agent_name, subtask) in &plan.task_breakdown {
80            println!("β€’ {} β†’ {}", agent_name, subtask);
81        }
82        println!();
83    }
84
85    // Step 6: Display spawned agents
86    println!("πŸ€– Spawned Agents:");
87    println!("-----------------");
88    let spawned = auto_forest.spawned_agents();
89    println!("Total agents created: {}\n", spawned.len());
90
91    for (i, spawned_agent) in spawned.iter().enumerate() {
92        println!("Agent {}: {}", i + 1, spawned_agent.config.name);
93        println!("  Role: {}", spawned_agent.config.role);
94        if let Some(result) = &spawned_agent.result {
95            println!("  Result available: Yes ({} chars)", result.len());
96        } else {
97            println!("  Result: Pending");
98        }
99        println!();
100    }
101
102    // Step 7: Display the final synthesized result
103    println!("πŸ“ˆ Final Synthesized Result:");
104    println!("==========================\n");
105    println!("{}\n", result);
106
107    // Step 8: Demonstrate a second task with different complexity
108    println!("\nπŸ”„ Executing a second task with different complexity...\n");
109
110    let simple_task = "Calculate the average of these numbers: 100, 200, 300, 400, 500. Then tell me what percentage each is of the total.";
111
112    println!("Task: {}\n", simple_task);
113    println!("πŸš€ Processing...\n");
114
115    let result2 = auto_forest.execute_task(simple_task).await?;
116
117    println!("Result:\n{}\n", result2);
118
119    if let Some(plan) = auto_forest.orchestration_plan() {
120        println!(
121            "This task resulted in {} agent(s) - a simpler orchestration plan.",
122            plan.num_agents
123        );
124        println!("Reasoning: {}\n", plan.reasoning);
125    }
126
127    println!("βœ… AutoForest demo completed!");
128    println!("=============================");
129    println!("\nπŸ’‘ Key Features Demonstrated:");
130    println!("  β€’ Automatic agent spawning based on task complexity");
131    println!("  β€’ Specialized agent prompt generation");
132    println!("  β€’ Task breakdown across agents");
133    println!("  β€’ Result aggregation and synthesis");
134    println!("  β€’ Flexible orchestration for varying task complexity");
135
136    Ok(())
137}
More examples
Hide additional examples
examples/ultra_simple.rs (line 40)
9async fn main() -> helios_engine::Result<()> {
10    println!("πŸš€ Ultra Simple Helios Example\n");
11
12    // ========== SIMPLEST AGENT CREATION ==========
13    println!("1️⃣  Creating an agent - shortest possible syntax:\n");
14
15    // One-liner: Create agent with auto config
16    let mut agent = Agent::builder("Helper")
17        .auto_config()
18        .prompt("You are helpful and concise.")
19        .build()
20        .await?;
21
22    println!("βœ“ Agent created!\n");
23
24    // ========== SIMPLEST CHAT ==========
25    println!("2️⃣  Asking questions - simplest possible:\n");
26
27    // Use .ask() instead of .chat() for more natural syntax
28    let answer = agent.ask("What is 2+2?").await?;
29    println!("Q: What is 2+2?\nA: {}\n", answer);
30
31    // ========== SIMPLEST CONFIG ==========
32    println!("3️⃣  Creating config with shortest syntax:\n");
33
34    // Ultra-short config creation
35    let _config = Config::builder()
36        .m("gpt-4") // .m() is shorthand for .model()
37        .key("your-api-key") // .key() is shorthand for .api_key()
38        .temp(0.8) // .temp() is shorthand for .temperature()
39        .tokens(1024) // .tokens() is shorthand for .max_tokens()
40        .build();
41
42    println!("βœ“ Config created with ultra-short syntax!\n");
43
44    // ========== SIMPLEST AGENT WITH TOOLS ==========
45    println!("4️⃣  Agent with tools - simplest way:\n");
46
47    let mut calc_agent = Agent::builder("Calculator")
48        .auto_config()
49        .prompt("You are a math expert.")
50        .with_tool(Box::new(CalculatorTool)) // Add single tool
51        .build()
52        .await?;
53
54    let result = calc_agent.ask("Calculate 15 * 7 + 5").await?;
55    println!("Q: Calculate 15 * 7 + 5\nA: {}\n", result);
56
57    // ========== SIMPLEST QUICK AGENT ==========
58    println!("5️⃣  Quick agent - one method call:\n");
59
60    // Agent::quick() creates agent in ONE LINE with auto config!
61    let mut quick_agent = Agent::quick("QuickBot").await?;
62    let quick_answer = quick_agent.ask("Say hello!").await?;
63    println!("Response: {}\n", quick_answer);
64
65    // ========== SIMPLEST CHAT MESSAGES ==========
66    println!("6️⃣  Creating messages - super short syntax:\n");
67
68    use helios_engine::ChatMessage;
69
70    // Short aliases for message creation
71    let _sys_msg = ChatMessage::sys("You are helpful"); // .sys() not .system()
72    let _user_msg = ChatMessage::msg("Hello there"); // .msg() not .user()
73    let _reply_msg = ChatMessage::reply("Hi! How can I help?"); // .reply() not .assistant()
74
75    println!("βœ“ Messages created with ultra-short syntax!\n");
76
77    // ========== SHORTEST AUTOFOREST ==========
78    println!("7️⃣  AutoForest - simplest multi-agent orchestration:\n");
79
80    use helios_engine::AutoForest;
81
82    let mut forest = AutoForest::new(Config::builder().m("gpt-4").build())
83        .with_tools(vec![Box::new(CalculatorTool)])
84        .build()
85        .await?;
86
87    // Use .run() for shortest syntax
88    let forest_result = forest.run("Analyze these numbers: 10, 20, 30, 40").await?;
89    println!("Forest Result:\n{}\n", forest_result);
90
91    // ========== COMPARISON TABLE ==========
92    println!("πŸ“Š Syntax Comparison - Short vs Long:\n");
93    println!("β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”");
94    println!("β”‚ Operation           β”‚ Short Syntax         β”‚ Long Syntax      β”‚");
95    println!("β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€");
96    println!("β”‚ Create Agent        β”‚ Agent::quick()       β”‚ Agent::builder()β”‚");
97    println!("β”‚ Ask Question        β”‚ .ask()               β”‚ .chat()          β”‚");
98    println!("β”‚ System Prompt       β”‚ .prompt()            β”‚ .system_prompt() β”‚");
99    println!("β”‚ Config Model        β”‚ .m()                 β”‚ .model()         β”‚");
100    println!("β”‚ Config Key          β”‚ .key()               β”‚ .api_key()       β”‚");
101    println!("β”‚ Config Temp         β”‚ .temp()              β”‚ .temperature()   β”‚");
102    println!("β”‚ Config Tokens       β”‚ .tokens()            β”‚ .max_tokens()    β”‚");
103    println!("β”‚ System Message      β”‚ ChatMessage::sys()   β”‚ ChatMessage::system()");
104    println!("β”‚ User Message        β”‚ ChatMessage::msg()   β”‚ ChatMessage::user()");
105    println!("β”‚ Assistant Message   β”‚ ChatMessage::reply() β”‚ ChatMessage::assistant()");
106    println!("β”‚ AutoForest Execute  β”‚ .run()               β”‚ .execute_task()  β”‚");
107    println!("β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜\n");
108
109    println!("βœ… All examples completed!");
110    println!("πŸ’‘ Tip: Mix and match short and long syntax based on your preference!");
111
112    Ok(())
113}

Trait ImplementationsΒ§

SourceΒ§

impl Default for ConfigBuilder

SourceΒ§

fn default() -> Self

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> 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> PolicyExt for T
where T: ?Sized,

SourceΒ§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
SourceΒ§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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