pub struct JsProofEnv { /* private fields */ }Expand description
Proof environment for the browser. Wraps ProofEnvironment + ultra caches.
Implementations§
Source§impl JsProofEnv
impl JsProofEnv
Sourcepub fn prove_dim_eq(
&mut self,
expected: u32,
actual: u32,
) -> Result<u32, JsError>
pub fn prove_dim_eq( &mut self, expected: u32, actual: u32, ) -> Result<u32, JsError>
Prove that two dimensions are equal. Returns proof term ID.
Throws if dimensions don’t match.
Sourcepub fn mk_vector_type(&mut self, dim: u32) -> Result<u32, JsError>
pub fn mk_vector_type(&mut self, dim: u32) -> Result<u32, JsError>
Build a RuVec n type term. Returns term ID.
Sourcepub fn mk_distance_metric(&mut self, metric: &str) -> Result<u32, JsError>
pub fn mk_distance_metric(&mut self, metric: &str) -> Result<u32, JsError>
Build a distance metric type term. Supported: “L2”, “Cosine”, “Dot”.
Sourcepub fn verify_dim_check(
&mut self,
index_dim: u32,
vector: &[f32],
) -> Result<u32, JsError>
pub fn verify_dim_check( &mut self, index_dim: u32, vector: &[f32], ) -> Result<u32, JsError>
Verify that a single vector has the expected dimension.
Sourcepub fn verify_batch_flat(
&mut self,
dim: u32,
flat_vectors: &[f32],
) -> Result<u32, JsError>
pub fn verify_batch_flat( &mut self, dim: u32, flat_vectors: &[f32], ) -> Result<u32, JsError>
Verify a batch of vectors (passed as flat f32 array + dimension).
flat_vectors is a contiguous f32 array; each vector is dim elements.
Returns the number of vectors verified.
Sourcepub fn arena_intern(&self, hash_hi: u32, hash_lo: u32) -> Vec<u32>
pub fn arena_intern(&self, hash_hi: u32, hash_lo: u32) -> Vec<u32>
Intern a hash into the FastTermArena. Returns [term_id, was_cached].
Sourcepub fn route_proof(&self, kind: &str) -> Result<JsValue, JsError>
pub fn route_proof(&self, kind: &str) -> Result<JsValue, JsError>
Route a proof to the cheapest tier. Returns tier name.
Sourcepub fn create_attestation(&self, proof_id: u32) -> Result<JsValue, JsError>
pub fn create_attestation(&self, proof_id: u32) -> Result<JsValue, JsError>
Create a proof attestation (82 bytes). Returns serializable object.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Reset the environment (clears cache, resets counters, re-registers builtins).
Sourcepub fn terms_allocated(&self) -> u32
pub fn terms_allocated(&self) -> u32
Number of terms currently allocated.
Trait Implementations§
Source§impl From<JsProofEnv> for JsValue
impl From<JsProofEnv> for JsValue
Source§fn from(value: JsProofEnv) -> Self
fn from(value: JsProofEnv) -> Self
Source§impl FromWasmAbi for JsProofEnv
impl FromWasmAbi for JsProofEnv
Source§impl IntoWasmAbi for JsProofEnv
impl IntoWasmAbi for JsProofEnv
Source§impl LongRefFromWasmAbi for JsProofEnv
impl LongRefFromWasmAbi for JsProofEnv
Source§impl OptionFromWasmAbi for JsProofEnv
impl OptionFromWasmAbi for JsProofEnv
Source§impl OptionIntoWasmAbi for JsProofEnv
impl OptionIntoWasmAbi for JsProofEnv
Source§impl RefFromWasmAbi for JsProofEnv
impl RefFromWasmAbi for JsProofEnv
Source§type Anchor = RcRef<JsProofEnv>
type Anchor = RcRef<JsProofEnv>
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for JsProofEnv
impl RefMutFromWasmAbi for JsProofEnv
Source§impl TryFromJsValue for JsProofEnv
impl TryFromJsValue for JsProofEnv
Source§impl VectorFromWasmAbi for JsProofEnv
impl VectorFromWasmAbi for JsProofEnv
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[JsProofEnv]>
Source§impl VectorIntoWasmAbi for JsProofEnv
impl VectorIntoWasmAbi for JsProofEnv
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[JsProofEnv]>) -> Self::Abi
Source§impl WasmDescribeVector for JsProofEnv
impl WasmDescribeVector for JsProofEnv
impl SupportsConstructor for JsProofEnv
impl SupportsInstanceProperty for JsProofEnv
impl SupportsStaticProperty for JsProofEnv
Auto Trait Implementations§
impl !Freeze for JsProofEnv
impl !RefUnwindSafe for JsProofEnv
impl Send for JsProofEnv
impl !Sync for JsProofEnv
impl Unpin for JsProofEnv
impl UnsafeUnpin for JsProofEnv
impl UnwindSafe for JsProofEnv
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> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.