pub struct JsDecisionSnapshot { /* private fields */ }Expand description
JavaScript-friendly wrapper for DecisionSnapshot
Represents a snapshot of an AI decision with inputs, outputs, and metadata. This is the main data structure for tracking AI decisions in JavaScript/TypeScript.
§Examples
import { JsDecisionSnapshot, JsInput, JsOutput } from 'briefcase-wasm';
const decision = new JsDecisionSnapshot("my_ai_function");
const input = new JsInput("user_query", "Hello", "string");
const output = new JsOutput("ai_response", "Hi there!", "string");
decision.add_input(input);
decision.add_output(output);
decision.set_execution_time(123.5);Implementations§
Source§impl JsDecisionSnapshot
impl JsDecisionSnapshot
pub fn new(function_name: &str) -> JsDecisionSnapshot
pub fn with_module(self, module_name: &str) -> JsDecisionSnapshot
pub fn add_input( self, name: &str, value: &JsValue, data_type: &str, ) -> Result<JsDecisionSnapshot, JsError>
pub fn add_output( self, name: &str, value: &JsValue, data_type: &str, ) -> Result<JsDecisionSnapshot, JsError>
pub fn add_tag(self, key: &str, value: &str) -> JsDecisionSnapshot
pub fn to_json(&self) -> Result<JsValue, JsError>
Trait Implementations§
Source§impl From<JsDecisionSnapshot> for JsValue
impl From<JsDecisionSnapshot> for JsValue
Source§fn from(value: JsDecisionSnapshot) -> Self
fn from(value: JsDecisionSnapshot) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for JsDecisionSnapshot
impl FromWasmAbi for JsDecisionSnapshot
Source§impl IntoWasmAbi for JsDecisionSnapshot
impl IntoWasmAbi for JsDecisionSnapshot
Source§impl RefFromWasmAbi for JsDecisionSnapshot
impl RefFromWasmAbi for JsDecisionSnapshot
Source§type Anchor = RcRef<JsDecisionSnapshot>
type Anchor = RcRef<JsDecisionSnapshot>
The type that holds the reference to
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 TryFromJsValue for JsDecisionSnapshot
impl TryFromJsValue for JsDecisionSnapshot
Source§impl VectorFromWasmAbi for JsDecisionSnapshot
impl VectorFromWasmAbi for JsDecisionSnapshot
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[JsDecisionSnapshot]>
Source§impl VectorIntoWasmAbi for JsDecisionSnapshot
impl VectorIntoWasmAbi for JsDecisionSnapshot
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[JsDecisionSnapshot]>) -> Self::Abi
Source§impl WasmDescribeVector for JsDecisionSnapshot
impl WasmDescribeVector for JsDecisionSnapshot
impl SupportsConstructor for JsDecisionSnapshot
impl SupportsInstanceProperty for JsDecisionSnapshot
impl SupportsStaticProperty for JsDecisionSnapshot
Auto Trait Implementations§
impl Freeze for JsDecisionSnapshot
impl RefUnwindSafe for JsDecisionSnapshot
impl Send for JsDecisionSnapshot
impl Sync for JsDecisionSnapshot
impl Unpin for JsDecisionSnapshot
impl UnwindSafe for JsDecisionSnapshot
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
Mutably borrows from an owned value. Read more
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
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.