Skip to main content

Dial

Struct Dial 

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

The effort a request carries, read per request.

The issue this exists for: [provider] reasoning_effort is copied into the client’s options when the client is built, so the one moment you want a different level — right after a turn that thought too little — is the one the running session cannot do. So the configured level stays the default, and a session override sits in front of it, in an Arc shared by every route the session opened.

Implementations§

Source§

impl Dial

Source

pub fn new(configured: Option<String>) -> Self

Source

pub fn effort(&self) -> Option<String>

What the next request should ask for: the session’s override, else the configuration.

Source

pub fn set_session(&self, level: Option<String>)

/reasoning <level>: from the next request on, in this process only.

Source

pub fn clear_session(&self)

Drop the override: the configuration is in force again.

Source

pub fn configured(&self) -> Option<&str>

What was configured, for a report that has to say “the same as the file”.

Source

pub fn overridden(&self) -> bool

Whether a session override is in force.

Source

pub fn in_force(&self) -> String

The level in force, with the one clause that makes an override visible: high, high (this session; config.toml says low), medium (this backend's default; config.toml sets nothing), or not sent.

This is the read-out’s wording and /reasoning’s, from one function, so the line under the composer cannot claim a level the report does not. Three answers, because a dial has three: the session asked (/reasoning high), the file asked, or neither did and the route’s own policy supplies the shipped default (#276). not sent is the fourth case and a fact, not a shrug: the backend takes no level, or nobody declared one, so the field is not on the wire.

Source§

impl Dial

Source

pub fn in_force_report(&self, default: Option<&str>) -> InForce

The dial’s own half of InForce: what it will ask for, why, and what that becomes.

default is the route in force’s declared default (#276): Some("medium") on both shipped profiles, None for a backend that declares no policy or no default. With no session override and no file value, that is the level the next request carries — and the label says not sent, not a guessed level, when even that is absent.

Trait Implementations§

Source§

impl Debug for Dial

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Dial

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Freeze for Dial

§

impl Forget for Dial

§

impl Move for Dial

§

impl RefUnwindSafe for Dial

§

impl Send for Dial
where RawVecInner: Send, Mutex<Option<Option<String>>>: Send,

§

impl Sync for Dial
where RawVecInner: Sync, Mutex<Option<Option<String>>>: Sync,

§

impl Unpin for Dial
where *const u8 is !null: Unpin, Align4<u32>: Unpin, Align1<u8>: Unpin,

§

impl UnsafeUnpin for Dial
where *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, Align4<u32>: UnsafeUnpin, Align1<u8>: UnsafeUnpin,

§

impl UnwindSafe for Dial
where RawVecInner: UnwindSafe, Mutex<Option<Option<String>>>: UnwindSafe,

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> 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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