pub struct FrameRouteService<State = (), E = Error> { /* private fields */ }
Expand description
Route Frame
to a Service
via API key
A simple example that routes MetadataRequest
and CreateTopicsRequest
.
ApiVersionsRequest
is created by the
builder including both of the implemented services using the version ranges
from RootMessageMeta
.
let router = FrameRouteService::<(), Error>::builder()
.with_service(
RequestLayer::<MetadataRequest>::new().into_layer(ResponseService::new(|_, _| {
Ok(MetadataResponse::default()
.brokers(Some([].into()))
.topics(Some([].into()))
.cluster_id(Some("tansu".into()))
.controller_id(Some(111))
.throttle_time_ms(Some(0))
.cluster_authorized_operations(Some(-1)))
})),
)
.and_then(|builder| {
builder.with_service(RequestLayer::<CreateTopicsRequest>::new().into_layer(
ResponseService::new(|_, _| {
Ok(CreateTopicsResponse::default()
.throttle_time_ms(Some(0))
.topics(Some([].into())))
}),
))
})
.and_then(|builder| builder.build())?;
Implementations§
Trait Implementations§
Source§impl<State: Clone, E: Clone> Clone for FrameRouteService<State, E>
impl<State: Clone, E: Clone> Clone for FrameRouteService<State, E>
Source§fn clone(&self) -> FrameRouteService<State, E>
fn clone(&self) -> FrameRouteService<State, E>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<State: Default, E: Default> Default for FrameRouteService<State, E>
impl<State: Default, E: Default> Default for FrameRouteService<State, E>
Source§fn default() -> FrameRouteService<State, E>
fn default() -> FrameRouteService<State, E>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<State, E> Freeze for FrameRouteService<State, E>
impl<State = (), E = Error> !RefUnwindSafe for FrameRouteService<State, E>
impl<State, E> Send for FrameRouteService<State, E>
impl<State, E> Sync for FrameRouteService<State, E>
impl<State, E> Unpin for FrameRouteService<State, E>
impl<State = (), E = Error> !UnwindSafe for FrameRouteService<State, E>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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