pub struct InMemoryPromptRegistry { /* private fields */ }Expand description
Holds registrations in memory for the life of a session.
Implementations§
Trait Implementations§
Source§impl Default for InMemoryPromptRegistry
impl Default for InMemoryPromptRegistry
Source§impl PromptRegistry for InMemoryPromptRegistry
impl PromptRegistry for InMemoryPromptRegistry
Source§fn register_block(&self, block: RegisteredBlock) -> Disposer
fn register_block(&self, block: RegisteredBlock) -> Disposer
Add a block. Dispose to remove it.
Source§fn register_variable(&self, name: &str, provider: VariableProvider) -> Disposer
fn register_variable(&self, name: &str, provider: VariableProvider) -> Disposer
Make
{{name}} expand to whatever provider returns, in every block.Source§fn register_assembly_hook(
&self,
hook: Arc<dyn AssemblyHook>,
authority: Authority,
) -> Disposer
fn register_assembly_hook( &self, hook: Arc<dyn AssemblyHook>, authority: Authority, ) -> Disposer
Add a pass over the whole assembled prompt — see
crate::interface::prompt_assembly. authority is what that pass
may do beyond adding, and is the registrar’s to establish honestly:
nothing downstream can tell a plugin apart from a script except by
what it was registered as.Source§fn blocks(&self) -> Vec<RegisteredBlock>
fn blocks(&self) -> Vec<RegisteredBlock>
Everything registered, in registration order. Assembly sorts.
Source§fn assembly_hooks(&self) -> Vec<(Arc<dyn AssemblyHook>, Authority)>
fn assembly_hooks(&self) -> Vec<(Arc<dyn AssemblyHook>, Authority)>
Every registered pass, in the order they run.
Source§fn register_async_assembly_hook(
&self,
hook: Arc<dyn AsyncAssemblyHook>,
authority: Authority,
) -> Disposer
fn register_async_assembly_hook( &self, hook: Arc<dyn AsyncAssemblyHook>, authority: Authority, ) -> Disposer
Add a pass that has to await something — a script carrier, most of
all. Kept separate from
register_assembly_hook
so a Rust hook that only rearranges strings is not an async function
for the sake of the one backend that has to be.Source§fn async_assembly_hooks(&self) -> Vec<(Arc<dyn AsyncAssemblyHook>, Authority)>
fn async_assembly_hooks(&self) -> Vec<(Arc<dyn AsyncAssemblyHook>, Authority)>
Every registered async pass, in the order they run.
Source§fn register_context(
&self,
name: &str,
order: i32,
provider: ContextProvider,
) -> Disposer
fn register_context( &self, name: &str, order: i32, provider: ContextProvider, ) -> Disposer
Add a block whose text is computed at assembly time. Read more
Auto Trait Implementations§
impl Forget for InMemoryPromptRegistry
impl Freeze for InMemoryPromptRegistry
impl Move for InMemoryPromptRegistry
impl RefUnwindSafe for InMemoryPromptRegistry
impl Send for InMemoryPromptRegistry
impl Sync for InMemoryPromptRegistry
impl Unpin for InMemoryPromptRegistry
impl UnsafeUnpin for InMemoryPromptRegistry
impl UnwindSafe for InMemoryPromptRegistry
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