Skip to main content

SystemOne

Struct SystemOne 

Source
pub struct SystemOne<'a, S, T: ?Sized, A = Answers> { /* private fields */ }
Expand description

A System One request, ready to be configured and sent.

Made by Client::system_one. A is what the answers decode into: Answers, a lookup by question name, unless typed names a type of the caller’s own.

Nothing is checked or encoded until send: the methods never fail, and a header or a body member that cannot be sent is reported by send.

Implementations§

Source§

impl<'a, S, T, A> SystemOne<'a, S, T, A>
where T: ?Sized,

Source

pub fn model(self, model: impl Into<Cow<'a, str>>) -> Self

The model to ask, instead of the client’s default.

Source

pub fn timeout(self, timeout: Duration) -> Self

The deadline of each attempt of this call, instead of the client’s.

Source

pub fn no_timeout(self) -> Self

No deadline on any attempt of this call.

Source

pub fn header( self, name: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, str>>, ) -> Self

A header for this call only. It replaces a client default of the same name; the SDK’s own headers still win over it, as they do over a default, and a later header of the same name replaces an earlier one. The headers the SDK or its transport owns are dropped without an error, as they are from a default; see ClientBuilder::default_header for the list, and for what Host does.

Source

pub fn retry(self, policy: RetryPolicy) -> Self

The retry policy of this call, in place of the client’s; the client and its other calls keep theirs.

Source

pub fn extra_body<V>(self, name: impl Into<Cow<'a, str>>, value: &V) -> Self
where V: Serialize + ?Sized,

A top-level member of the request body beside state, model and questions, for a parameter the API has and this SDK does not model.

Merging is last-write-wins, as in the Python SDK: a later member of the same name replaces an earlier one, and a member named state, model or questions replaces that built-in one in place. The value is encoded now; a value that cannot be encoded fails the call when it is sent.

Source

pub fn typed<B>(self) -> SystemOne<'a, S, T, B>
where B: AnswerSet,

Decodes the answers into B instead: a struct with one field per question, for instance, which reads each answer straight into its field.

Source§

impl<S, T, A> SystemOne<'_, S, T, A>
where S: HttpService, T: Serialize + ?Sized, A: AnswerSet,

Source

pub async fn send(self) -> Result<SystemOneResponse<A>, Error>

Sends the request and decodes the answer, retrying a failure as the call’s retry policy, or else the client’s, says.

The body is encoded once: every attempt sends the same bytes. When retrying stops, the error is the one the last attempt failed with.

§Errors

Trait Implementations§

Source§

impl<S, T, A> Debug for SystemOne<'_, S, T, A>
where T: ?Sized,

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

The request’s settings: no state, no header value and no body member, which are the caller’s data. A retry policy is shown when the call has one of its own.

Auto Trait Implementations§

§

impl<'a, S, T, A = Answers> !RefUnwindSafe for SystemOne<'a, S, T, A>

§

impl<'a, S, T, A = Answers> !UnwindSafe for SystemOne<'a, S, T, A>

§

impl<'a, S, T, A> Freeze for SystemOne<'a, S, T, A>
where &'a Client<S>: Freeze, &'a T: Freeze, PhantomData<fn() -> A>: Freeze, T: ?Sized,

§

impl<'a, S, T, A> Send for SystemOne<'a, S, T, A>
where &'a Client<S>: Send, &'a T: Send, PhantomData<fn() -> A>: Send, T: ?Sized,

§

impl<'a, S, T, A> Sync for SystemOne<'a, S, T, A>
where &'a Client<S>: Sync, &'a T: Sync, PhantomData<fn() -> A>: Sync, T: ?Sized,

§

impl<'a, S, T, A> Unpin for SystemOne<'a, S, T, A>
where &'a Client<S>: Unpin, &'a T: Unpin, PhantomData<fn() -> A>: Unpin, T: ?Sized,

§

impl<'a, S, T, A> UnsafeUnpin for SystemOne<'a, S, T, A>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more