pub struct NodeDefaults {
pub retry: Option<RetryPolicy>,
pub timeout: Option<TimeoutPolicy>,
pub error_handler: Option<NodeErrorHandler>,
}Expand description
Policies a graph applies to every node that does not set its own.
Repeating the same retry or timeout on twenty nodes is easy to get wrong by omission. A default states it once; a per-node value always wins.
§Example
use adk_graph::graph::NodeDefaults;
use adk_graph::retry::RetryPolicy;
use adk_graph::timeout::TimeoutPolicy;
use std::time::Duration;
let defaults = NodeDefaults::new().with_retry(RetryPolicy::new(3)).with_timeout(
TimeoutPolicy { run_timeout: Some(Duration::from_secs(30)), ..Default::default() },
);Fields§
§retry: Option<RetryPolicy>Retry policy for a node with none of its own.
timeout: Option<TimeoutPolicy>Timeout policy for a node with none of its own.
error_handler: Option<NodeErrorHandler>Failure handler for a node with none of its own.
Implementations§
Source§impl NodeDefaults
impl NodeDefaults
Sourcepub fn with_retry(self, policy: RetryPolicy) -> Self
pub fn with_retry(self, policy: RetryPolicy) -> Self
Applies this retry policy to every node that sets none.
Sourcepub fn with_timeout(self, policy: TimeoutPolicy) -> Self
pub fn with_timeout(self, policy: TimeoutPolicy) -> Self
Applies this timeout policy to every node that sets none.
Sourcepub fn with_error_handler<F>(self, handler: F) -> Self
pub fn with_error_handler<F>(self, handler: F) -> Self
Applies this failure handler to every node that sets none.
Trait Implementations§
Source§impl Clone for NodeDefaults
impl Clone for NodeDefaults
Source§fn clone(&self) -> NodeDefaults
fn clone(&self) -> NodeDefaults
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 NodeDefaults
impl Debug for NodeDefaults
Source§impl Default for NodeDefaults
impl Default for NodeDefaults
Source§fn default() -> NodeDefaults
fn default() -> NodeDefaults
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for NodeDefaults
impl !UnwindSafe for NodeDefaults
impl Freeze for NodeDefaults
impl Send for NodeDefaults
impl Sync for NodeDefaults
impl Unpin for NodeDefaults
impl UnsafeUnpin for NodeDefaults
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