Skip to main content

ContextViews

Struct ContextViews 

Source
pub struct ContextViews { /* private fields */ }
Expand description

Bounded view definitions for a single host-owned graph. Stores no duplicate documents.

Implementations§

Source§

impl ContextViews

Source

pub fn define( &mut self, spec: ContextViewSpec, ) -> Result<ContextViewHandle, ContextError>

Define or replace a host-owned scope. Every replacement invalidates its old handles.

Source

pub fn revoke(&mut self, id: &str) -> bool

Revoke a scope. Existing context cannot be used through that view afterward.

Source

pub fn compile( &self, graph: &ContextGraph, handle: &ContextViewHandle, request: &ContextRequest, tokenizer: &impl TokenCounter, ) -> Result<ContextView, ContextError>

Compile against current authorized sources. Request allowed may only narrow access.

Source

pub fn replace_source( &self, graph: &mut ContextGraph, handle: &ContextViewHandle, source: &str, documents: Vec<Document>, ) -> Result<SourceUpdate, ContextError>

Atomic replacement restricted to a writable source, including cross-source ID collisions.

Source

pub fn check_answer( &self, graph: &ContextGraph, handle: &ContextViewHandle, context: &ContextView, draft: &AnswerDraft, reviews: &[ClaimReview], policy: &AnswerPolicy, tokenizer: &impl TokenCounter, ) -> Result<ContextViewAssessment, ContextError>

Freshly validate the whole readable scope and recompile before applying trusted reviews. Alpha policy is conservative: ANY authorized document/edge change requires a new review, including unselected evidence. Unrelated writes outside this view do not invalidate it.

Source

pub fn explain( &self, graph: &ContextGraph, handle: &ContextViewHandle, context: &ContextView, tokenizer: &impl TokenCounter, ) -> Result<SelectionExplanation, ContextError>

Reconstruct only successful selection steps after checking the current whole scope. Revocation and any in-scope change invalidate the explanation, including unselected data.

Trait Implementations§

Source§

impl Default for ContextViews

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.