Skip to main content

Surface

Struct Surface 

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

The catalog bound to a store, a default repo and optional providers.

Implementations§

Source§

impl Surface

Source

pub fn new( store: Store, default_repo: &str, provider: Option<Box<dyn EmbeddingProvider>>, ) -> Self

A surface over store whose default repo is default_repo (an id). Mutations derive each repo’s root from its fs source.

Source

pub fn with_doc_store(self, doc_store: Box<dyn DocStore>) -> Self

Route every mutation’s file writes through doc_store regardless of the repo’s sources (a runner’s in-memory store).

Source

pub fn with_clock(self, clock: impl FnMut() -> String + 'static) -> Self

Stamp commits with clock() instead of the wall clock.

Source

pub fn with_mutation_hook(self, hook: impl FnMut() + 'static) -> Self

Called after every successful write (never after a dry run).

Source

pub fn with_config(self, config: Config) -> Self

The matcher thresholds the observe tools pass through.

Source

pub fn store(&self) -> &Store

Source

pub fn store_mut(&mut self) -> &mut Store

Source

pub fn default_repo(&self) -> &str

Source

pub fn tools(&self) -> Vec<ToolSpec>

The catalog.

Source

pub fn is_write_tool(name: &str) -> bool

Whether name is a tool that can commit (a host serializes these under the writer lock of spec/sync §7; dry_run calls still count here — only the mutation hook knows a write actually happened).

Source

pub fn call(&mut self, name: &str, args: Json) -> ToolOutcome

Run a tool: its JSON result, or the error envelope.

Source

pub fn call_result(&mut self, name: &str, args: &Json) -> Result<Json>

Run a tool, returning its result or the error.

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.