pub struct ContextInjectionBuffer { /* private fields */ }Expand description
Accumulates context strings by channel until the host drains them.
Implementations§
Source§impl ContextInjectionBuffer
impl ContextInjectionBuffer
Sourcepub fn push(&mut self, channel: ContextChannel, text: impl Into<String>)
pub fn push(&mut self, channel: ContextChannel, text: impl Into<String>)
Append one item.
Sourcepub fn extend(
&mut self,
items: impl IntoIterator<Item = (ContextChannel, String)>,
)
pub fn extend( &mut self, items: impl IntoIterator<Item = (ContextChannel, String)>, )
Append many items.
Sourcepub fn drain_channel(&mut self, channel: ContextChannel) -> Vec<String>
pub fn drain_channel(&mut self, channel: ContextChannel) -> Vec<String>
Drain all items for one channel (preserving relative order among them).
Sourcepub fn drain_all(&mut self) -> Vec<(ContextChannel, String)>
pub fn drain_all(&mut self) -> Vec<(ContextChannel, String)>
Drain every item; returns (channel, text) in order.
Sourcepub fn take_pre_prompt_joined(&mut self) -> Option<String>
pub fn take_pre_prompt_joined(&mut self) -> Option<String>
Join drained PrePrompt texts with blank lines (common host helper).
Sourcepub fn iter(&self) -> impl Iterator<Item = &(ContextChannel, String)>
pub fn iter(&self) -> impl Iterator<Item = &(ContextChannel, String)>
Peek without draining.
Trait Implementations§
Source§impl Clone for ContextInjectionBuffer
impl Clone for ContextInjectionBuffer
Source§fn clone(&self) -> ContextInjectionBuffer
fn clone(&self) -> ContextInjectionBuffer
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 ContextInjectionBuffer
impl Debug for ContextInjectionBuffer
Source§impl Default for ContextInjectionBuffer
impl Default for ContextInjectionBuffer
Source§fn default() -> ContextInjectionBuffer
fn default() -> ContextInjectionBuffer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ContextInjectionBuffer
impl RefUnwindSafe for ContextInjectionBuffer
impl Send for ContextInjectionBuffer
impl Sync for ContextInjectionBuffer
impl Unpin for ContextInjectionBuffer
impl UnsafeUnpin for ContextInjectionBuffer
impl UnwindSafe for ContextInjectionBuffer
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