Struct Server
pub struct Server<S> { /* private fields */ }icap and std only.Expand description
ICAP server backed by an ordinary Rama request service.
Server owns connection reuse, close handling, Preview decisions, and the
bounded driver between the wire transaction and IncomingRequest. The
inner service receives a lifetime-independent request with a backpressured
streaming body and returns an OutgoingResponse. It can therefore use
the normal Rama service layers. An outgoing body may retain the incoming
body and transform it incrementally; the connection driver continues
serving body reads while it writes response frames.
Server itself implements Service for Rama streams with
ExtensionsRef, so it can be
passed directly to listeners such as
rama_tcp::server::TcpListener::serve.
Implementations§
§impl<S> Server<S>
impl<S> Server<S>
pub fn new(
inner: S,
service_tag: impl AsRef<[u8]>,
) -> Result<Server<S>, BuildError>
pub fn new( inner: S, service_tag: impl AsRef<[u8]>, ) -> Result<Server<S>, BuildError>
Create an ICAP server wrapping inner.
pub const fn with_options(self, options: ConnectionOptions) -> Server<S>
pub const fn with_options(self, options: ConnectionOptions) -> Server<S>
Set the options used by each accepted ICAP connection.
pub fn set_options(&mut self, options: ConnectionOptions) -> &mut Server<S>
pub fn set_options(&mut self, options: ConnectionOptions) -> &mut Server<S>
Set the options used by each accepted ICAP connection.
pub const fn options(&self) -> &ConnectionOptions
pub const fn options(&self) -> &ConnectionOptions
Return the options used by accepted ICAP connections.
pub fn service_tag(&self) -> &[u8] ⓘ
pub fn service_tag(&self) -> &[u8] ⓘ
Return the quoted ICAP service tag used for interim responses.
pub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Consumes self, returning the underlying service.
pub fn serve_connection<IO>(
&self,
io: IO,
) -> impl Future<Output = Result<(), ServerError>> + Sendwhere
IO: Io + Unpin + ExtensionsRef,
S: Service<IncomingRequest, Output = OutgoingResponse>,
<S as Service<IncomingRequest>>::Error: Into<Box<dyn Error + Send + Sync>>,
pub fn serve_connection<IO>(
&self,
io: IO,
) -> impl Future<Output = Result<(), ServerError>> + Sendwhere
IO: Io + Unpin + ExtensionsRef,
S: Service<IncomingRequest, Output = OutgoingResponse>,
<S as Service<IncomingRequest>>::Error: Into<Box<dyn Error + Send + Sync>>,
Serve one established stream.
Trait Implementations§
§impl<S, IO> Service<IO> for Server<S>where
IO: Io + Unpin + ExtensionsRef,
S: Service<IncomingRequest, Output = OutgoingResponse>,
<S as Service<IncomingRequest>>::Error: Into<Box<dyn Error + Send + Sync>>,
impl<S, IO> Service<IO> for Server<S>where
IO: Io + Unpin + ExtensionsRef,
S: Service<IncomingRequest, Output = OutgoingResponse>,
<S as Service<IncomingRequest>>::Error: Into<Box<dyn Error + Send + Sync>>,
§type Error = ServerError
type Error = ServerError
§fn serve(
&self,
io: IO,
) -> impl Future<Output = Result<<Server<S> as Service<IO>>::Output, <Server<S> as Service<IO>>::Error>> + Send
fn serve( &self, io: IO, ) -> impl Future<Output = Result<<Server<S> as Service<IO>>::Output, <Server<S> as Service<IO>>::Error>> + Send
§fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
Auto Trait Implementations§
impl<S> !Freeze for Server<S>
impl<S> RefUnwindSafe for Server<S>where
S: RefUnwindSafe,
impl<S> Send for Server<S>where
S: Send,
impl<S> Sync for Server<S>where
S: Sync,
impl<S> Unpin for Server<S>where
S: Unpin,
impl<S> UnsafeUnpin for Server<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for Server<S>where
S: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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> ⓘ
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> ⓘ
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more