pub struct GraphRegistry { /* private fields */ }Expand description
Named registry for compiled graphs.
Stores graphs as type-erased Arc<dyn Any> values. Retrieval requires
specifying the correct state type S — a type mismatch returns None.
§Example
ⓘ
let mut registry = GraphRegistry::new();
registry.register("react-agent", compiled_graph);
let graph: Option<&CompiledGraph<MyState>> = registry.get("react-agent");Implementations§
Source§impl GraphRegistry
impl GraphRegistry
Sourcepub fn register<S: State + 'static>(
&mut self,
name: impl Into<String>,
graph: CompiledGraph<S>,
)
pub fn register<S: State + 'static>( &mut self, name: impl Into<String>, graph: CompiledGraph<S>, )
Register a compiled graph under a name.
Overwrites any existing graph with the same name.
Sourcepub fn get<S: State + 'static>(&self, name: &str) -> Option<&CompiledGraph<S>>
pub fn get<S: State + 'static>(&self, name: &str) -> Option<&CompiledGraph<S>>
Retrieve a graph by name, downcasting to the expected state type.
Returns None if the name doesn’t exist or the type doesn’t match.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for GraphRegistry
impl !UnwindSafe for GraphRegistry
impl Freeze for GraphRegistry
impl Send for GraphRegistry
impl Sync for GraphRegistry
impl Unpin for GraphRegistry
impl UnsafeUnpin for GraphRegistry
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