#[non_exhaustive]pub struct Serving {
pub effect: EffectId,
pub handler: HandlerKey,
pub provider: Option<ProviderId>,
}Expand description
What an outgoing HTTP request to a model serves, in its extensions: the effect it answers and the handler it was dispatched to. A model adapter sets it on every request it sends, so a transport wrapper can tell one model call’s requests from another’s and from those of no call, such as a model listing. The request’s headers and body are the wrapper’s to read; rig records neither.
use rig_core::http_client::Request;
use rig_core::serve::Serving;
fn served(request: &Request<Vec<u8>>) -> Option<u64> {
request
.extensions()
.get::<Serving>()
.map(|serving| serving.effect.as_u64())
}
assert_eq!(served(&Request::new(Vec::new())), None);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.effect: EffectIdThe effect the request answers, such as an ECS effect’s id.
handler: HandlerKeyThe handler it was dispatched to, such as model:openai/gpt-5.
provider: Option<ProviderId>The provider the model is reached through, when the model was connected from a catalog spec.
Trait Implementations§
impl Eq for Serving
impl StructuralPartialEq for Serving
Auto Trait Implementations§
impl Freeze for Serving
impl RefUnwindSafe for Serving
impl Send for Serving
impl Sync for Serving
impl Unpin for Serving
impl UnsafeUnpin for Serving
impl UnwindSafe for Serving
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more