Skip to main content

Registry

Struct Registry 

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

Everything known about who proves what.

Implementations§

Source§

impl Registry

Source

pub fn new() -> Self

A registry that knows only about this process.

Source

pub fn add_environment( &mut self, environment: Environment, ) -> Result<(), RegistryError>

Introduces a place implementations can run.

Source

pub fn register( &mut self, implementation: Implementation, ) -> Result<(), RegistryError>

Records that something proves a proposition.

Source

pub fn register_native<F, Fut>(&mut self, entry: &str, f: F)
where F: Fn(Vec<Value>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Value, ExecError>> + Send + 'static,

Registers a function compiled into this process, under an entry name that an implementation can point at.

This is a module registering itself as an execution source, in the case where the module happens to be linked in.

Source

pub fn register_native_sync<F>(&mut self, entry: &str, f: F)
where F: Fn(Vec<Value>) -> Result<Value, ExecError> + Send + Sync + 'static,

The same, for a function that does not need to wait for anything.

Source

pub fn register_bodies( &mut self, ws: &CheckedWorkspace, ) -> Result<usize, RegistryError>

Registers every signature that carries its own proof.

A body is an implementation already: it needs no environment beyond this process and no one to write it. Derived bridges arrive this way.

Source

pub fn load_manifest( &mut self, text: &str, base: &Path, ) -> Result<usize, RegistryError>

Takes in a module’s declaration of what it can prove.

Relative paths inside are resolved against base, which is the directory the declaration came from, so that a manifest means the same thing wherever it is loaded from.

Source

pub fn load_manifest_file( &mut self, path: &Path, ) -> Result<usize, RegistryError>

Reads a manifest from a file.

Source

pub fn proofs_of(&self, sig: &QualifiedName) -> Vec<&Implementation>

Everything that claims to prove a proposition, in registration order.

Source

pub fn implementation(&self, id: &ImplId) -> Option<&Implementation>

One implementation, by name.

Source

pub fn implementations(&self) -> &[Implementation]

Every implementation, in registration order.

Source

pub fn environment(&self, id: &Ident) -> Option<&Environment>

One environment, by name.

Source

pub fn environments(&self) -> impl Iterator<Item = &Environment>

Every environment, by name.

Source

pub fn native(&self, entry: &str) -> Option<&NativeFn>

A function compiled into this process, by entry name.

Source

pub fn check_against(&self, ws: &CheckedWorkspace) -> Vec<RegistryWarning>

Checks what is registered against what the workspace actually declares.

Catches the two ways a registry drifts: an implementation proving something nobody declares, and one written against a proposition that has since changed out from under it.

Trait Implementations§

Source§

impl Default for Registry

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, 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.