pub struct Client { /* private fields */ }Expand description
Cloneable, pooled HTTP/1 client with verified TLS. No redirects, automatic retries or environment proxies. DNS hostnames must be ASCII (use punycode for IDN). A Tokio runtime is required for requests.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(base_url: &str) -> Result<Self, Error>
pub fn new(base_url: &str) -> Result<Self, Error>
Connect to a server root with the default timeout and no authentication.
Sourcepub fn with_options(options: ClientOptions<'_>) -> Result<Self, Error>
pub fn with_options(options: ClientOptions<'_>) -> Result<Self, Error>
Validate configuration and build a connection pool. TLS uses an explicit per-client ring provider and the platform’s certificate verifier; no process-global crypto provider is installed.
Sourcepub async fn decide<Q: QuestionSet>(
&self,
state: impl Into<Value>,
questions: &Q,
) -> Result<TypedDecisionResponse<Q::Schema>, Error>
pub async fn decide<Q: QuestionSet>( &self, state: impl Into<Value>, questions: &Q, ) -> Result<TypedDecisionResponse<Q::Schema>, Error>
Decide from a JSON state and typed question builder.
Sourcepub async fn decide_with_options<Q: QuestionSet>(
&self,
state: impl Into<Value>,
questions: &Q,
options: DecisionOptions<'_>,
) -> Result<TypedDecisionResponse<Q::Schema>, Error>
pub async fn decide_with_options<Q: QuestionSet>( &self, state: impl Into<Value>, questions: &Q, options: DecisionOptions<'_>, ) -> Result<TypedDecisionResponse<Q::Schema>, Error>
Typed decision with explicit model/facts options.
Sourcepub async fn decide_request(
&self,
request: &DecisionRequest,
) -> Result<DecisionResponse, Error>
pub async fn decide_request( &self, request: &DecisionRequest, ) -> Result<DecisionResponse, Error>
POST /v1/basal. Request fields and capability limits are validated by the server.
Sourcepub async fn models(&self) -> Result<ModelsResponse, Error>
pub async fn models(&self) -> Result<ModelsResponse, Error>
GET /v1/models.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
impl Freeze for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
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