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 InMemoryPromptRegistrywhere
*const ArcInner<Mutex<Vec<(RegistrationId, RegisteredBlock)>>> is !null: Freeze,
PhantomData<ArcInner<Mutex<Vec<(RegistrationId, RegisteredBlock)>>>>: Freeze,
*const ArcInner<Mutex<Vec<(RegistrationId, String, Arc<dyn for<'a> Fn(&ScenePromptContext<'a>) -> Option<String> + Sync + Send>)>>> is !null: Freeze,
PhantomData<ArcInner<Mutex<Vec<(RegistrationId, String, Arc<dyn for<'a> Fn(&ScenePromptContext<'a>) -> Option<String> + Sync + Send>)>>>>: Freeze,
*const ArcInner<Mutex<Vec<(RegistrationId, Arc<dyn AssemblyHook>, Authority)>>> is !null: Freeze,
PhantomData<ArcInner<Mutex<Vec<(RegistrationId, Arc<dyn AssemblyHook>, Authority)>>>>: Freeze,
*const ArcInner<Mutex<Vec<(RegistrationId, Arc<dyn AsyncAssemblyHook>, Authority)>>> is !null: Freeze,
PhantomData<ArcInner<Mutex<Vec<(RegistrationId, Arc<dyn AsyncAssemblyHook>, Authority)>>>>: Freeze,
impl Move for InMemoryPromptRegistry
impl RefUnwindSafe for InMemoryPromptRegistrywhere
Atomic<usize>: RefUnwindSafe,
Mutex<Vec<(RegistrationId, RegisteredBlock)>>: RefUnwindSafe,
Mutex<Vec<(RegistrationId, String, Arc<dyn for<'a> Fn(&ScenePromptContext<'a>) -> Option<String> + Sync + Send>)>>: RefUnwindSafe,
Mutex<Vec<(RegistrationId, Arc<dyn AssemblyHook>, Authority)>>: RefUnwindSafe,
Mutex<Vec<(RegistrationId, Arc<dyn AsyncAssemblyHook>, Authority)>>: RefUnwindSafe,
impl Send for InMemoryPromptRegistrywhere
Arc<Mutex<Vec<(RegistrationId, RegisteredBlock)>>>: Send,
Arc<Mutex<Vec<(RegistrationId, String, Arc<dyn for<'a> Fn(&ScenePromptContext<'a>) -> Option<String> + Sync + Send>)>>>: Send,
Arc<Mutex<Vec<(RegistrationId, Arc<dyn AssemblyHook>, Authority)>>>: Send,
Arc<Mutex<Vec<(RegistrationId, Arc<dyn AsyncAssemblyHook>, Authority)>>>: Send,
impl Sync for InMemoryPromptRegistrywhere
Arc<Mutex<Vec<(RegistrationId, RegisteredBlock)>>>: Sync,
Arc<Mutex<Vec<(RegistrationId, String, Arc<dyn for<'a> Fn(&ScenePromptContext<'a>) -> Option<String> + Sync + Send>)>>>: Sync,
Arc<Mutex<Vec<(RegistrationId, Arc<dyn AssemblyHook>, Authority)>>>: Sync,
Arc<Mutex<Vec<(RegistrationId, Arc<dyn AsyncAssemblyHook>, Authority)>>>: Sync,
impl Unpin for InMemoryPromptRegistrywhere
Arc<Mutex<Vec<(RegistrationId, RegisteredBlock)>>>: Unpin,
Arc<Mutex<Vec<(RegistrationId, String, Arc<dyn for<'a> Fn(&ScenePromptContext<'a>) -> Option<String> + Sync + Send>)>>>: Unpin,
Arc<Mutex<Vec<(RegistrationId, Arc<dyn AssemblyHook>, Authority)>>>: Unpin,
Arc<Mutex<Vec<(RegistrationId, Arc<dyn AsyncAssemblyHook>, Authority)>>>: Unpin,
impl UnsafeUnpin for InMemoryPromptRegistrywhere
*const ArcInner<Mutex<Vec<(RegistrationId, RegisteredBlock)>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Mutex<Vec<(RegistrationId, RegisteredBlock)>>>>: UnsafeUnpin,
*const ArcInner<Mutex<Vec<(RegistrationId, String, Arc<dyn for<'a> Fn(&ScenePromptContext<'a>) -> Option<String> + Sync + Send>)>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Mutex<Vec<(RegistrationId, String, Arc<dyn for<'a> Fn(&ScenePromptContext<'a>) -> Option<String> + Sync + Send>)>>>>: UnsafeUnpin,
*const ArcInner<Mutex<Vec<(RegistrationId, Arc<dyn AssemblyHook>, Authority)>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Mutex<Vec<(RegistrationId, Arc<dyn AssemblyHook>, Authority)>>>>: UnsafeUnpin,
*const ArcInner<Mutex<Vec<(RegistrationId, Arc<dyn AsyncAssemblyHook>, Authority)>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Mutex<Vec<(RegistrationId, Arc<dyn AsyncAssemblyHook>, Authority)>>>>: UnsafeUnpin,
impl UnwindSafe for InMemoryPromptRegistrywhere
Arc<Mutex<Vec<(RegistrationId, RegisteredBlock)>>>: UnwindSafe,
Arc<Mutex<Vec<(RegistrationId, String, Arc<dyn for<'a> Fn(&ScenePromptContext<'a>) -> Option<String> + Sync + Send>)>>>: UnwindSafe,
Arc<Mutex<Vec<(RegistrationId, Arc<dyn AssemblyHook>, Authority)>>>: UnwindSafe,
Arc<Mutex<Vec<(RegistrationId, Arc<dyn AsyncAssemblyHook>, Authority)>>>: UnwindSafe,
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