pub struct Extensions { /* private fields */ }Expand description
Type-keyed extension map for StepContext.
Each slot is keyed by TypeId and holds one value of that type.
Plugins insert domain-specific state (e.g. InferenceContext, ToolGate)
via the Action::apply method; the loop reads
them back after a phase completes.
Implementations§
Source§impl Extensions
impl Extensions
pub fn new() -> Self
Sourcepub fn get<T: 'static + Send>(&self) -> Option<&T>
pub fn get<T: 'static + Send>(&self) -> Option<&T>
Get a shared reference to the value of type T.
Sourcepub fn get_mut<T: 'static + Send>(&mut self) -> Option<&mut T>
pub fn get_mut<T: 'static + Send>(&mut self) -> Option<&mut T>
Get a mutable reference to the value of type T.
Sourcepub fn get_or_default<T: 'static + Send + Default>(&mut self) -> &mut T
pub fn get_or_default<T: 'static + Send + Default>(&mut self) -> &mut T
Get a mutable reference, inserting T::default() if absent.
Trait Implementations§
Source§impl Debug for Extensions
impl Debug for Extensions
Auto Trait Implementations§
impl Freeze for Extensions
impl !RefUnwindSafe for Extensions
impl Send for Extensions
impl !Sync for Extensions
impl Unpin for Extensions
impl UnsafeUnpin for Extensions
impl !UnwindSafe for Extensions
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