pub struct HelperContext<'a> {
pub content: &'a str,
pub candidates: &'a [MemoryHandle],
pub content_embedding: Option<&'a [f32]>,
pub namespace: Option<&'a str>,
}Expand description
Borrowed runtime inputs threaded into Phase 1 deterministic helper
stages. The Form 3 executor constructs ONE of these per run() and
reuses it across every helper stage so the content string is passed
by reference, not cloned per-helper (issue #782 PERF-11).
The fields are public so test scaffolding under cfg(test) can
construct a context directly; production callers go through the
executor.
Fields§
§content: &'a strIncoming content slice — borrowed from the caller’s owned
String. The same &str is threaded into every helper stage
within a run, so content.as_ptr() is stable across stages.
This is the load-bearing invariant pinned by the
multistep_phase_1_helpers_receive_content_borrow_not_clone
integration test.
candidates: &'a [MemoryHandle]Candidate memory set — borrowed slice, not cloned.
content_embedding: Option<&'a [f32]>Optional caller-supplied embedding for the content (cosine pre-filter input).
namespace: Option<&'a str>Optional namespace hint forwarded to the FTS classifier.
Implementations§
Source§impl<'a> HelperContext<'a>
impl<'a> HelperContext<'a>
Sourcepub fn new(
content: &'a str,
candidates: &'a [MemoryHandle],
content_embedding: Option<&'a [f32]>,
namespace: Option<&'a str>,
) -> Self
pub fn new( content: &'a str, candidates: &'a [MemoryHandle], content_embedding: Option<&'a [f32]>, namespace: Option<&'a str>, ) -> Self
Construct a borrowed context from the runtime inputs.
Sourcepub fn effective_content<'p>(&self, params: &'p HelperParams) -> &'p strwhere
'a: 'p,
pub fn effective_content<'p>(&self, params: &'p HelperParams) -> &'p strwhere
'a: 'p,
Resolve the effective content slice for this invocation. The
descriptor params.content wins when non-empty (rare pipeline
override); otherwise the context’s borrowed slice is returned
verbatim. No String allocation.
Trait Implementations§
Source§impl<'a> Clone for HelperContext<'a>
impl<'a> Clone for HelperContext<'a>
Source§fn clone(&self) -> HelperContext<'a>
fn clone(&self) -> HelperContext<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<'a> Copy for HelperContext<'a>
Auto Trait Implementations§
impl<'a> Freeze for HelperContext<'a>
impl<'a> RefUnwindSafe for HelperContext<'a>
impl<'a> Send for HelperContext<'a>
impl<'a> Sync for HelperContext<'a>
impl<'a> Unpin for HelperContext<'a>
impl<'a> UnsafeUnpin for HelperContext<'a>
impl<'a> UnwindSafe for HelperContext<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more