Struct ClientConnection
pub struct ClientConnection<IO> { /* private fields */ }icap and std only.Expand description
A sequential ICAP client over an established byte stream.
Create a streaming request with ClientConnection::start. A
connection is reusable only after the returned response body reaches its
terminal chunk. Dropping a transaction early leaves it poisoned so a
later request cannot accidentally reuse desynchronized framing.
Implementations§
§impl<IO> ClientConnection<IO>
impl<IO> ClientConnection<IO>
pub async fn send_http(
&mut self,
request: ClientRequest,
) -> Result<ClientResponse<'_, IO>, Error>
pub async fn send_http( &mut self, request: ClientRequest, ) -> Result<ClientResponse<'_, IO>, Error>
Send a typed HTTP adaptation request with the default head parser.
The HTTP entity body remains streaming. While its next frame is pending, the connection monitors for an early ICAP response as required by the ICAP errata. Cancelling this operation leaves the connection non-reusable.
pub async fn send_http_with(
&mut self,
request: ClientRequest,
parser: HeadParser,
) -> Result<ClientResponse<'_, IO>, Error>
pub async fn send_http_with( &mut self, request: ClientRequest, parser: HeadParser, ) -> Result<ClientResponse<'_, IO>, Error>
Send a typed HTTP adaptation request with explicit parser bounds.
pub async fn send_http_owned(
self,
request: ClientRequest,
) -> Result<OwnedClientResponse<IO>, Error>
pub async fn send_http_owned( self, request: ClientRequest, ) -> Result<OwnedClientResponse<IO>, Error>
Consume this connection and send one owned HTTP adaptation request.
The returned response owns the connection, so it can be moved into a Rama HTTP body or across a service boundary without a task or channel.
pub async fn send_http_owned_with(
self,
request: ClientRequest,
parser: HeadParser,
) -> Result<OwnedClientResponse<IO>, Error>
pub async fn send_http_owned_with( self, request: ClientRequest, parser: HeadParser, ) -> Result<OwnedClientResponse<IO>, Error>
Consume this connection and send one owned HTTP adaptation request with explicit parser bounds.
§impl<IO> ClientConnection<IO>
impl<IO> ClientConnection<IO>
pub fn new(io: IO) -> ClientConnection<IO>
pub fn new(io: IO) -> ClientConnection<IO>
Wrap an established stream with default connection options.
Bare streams can use rama_core::ServiceInput to supply the Rama
connection extension store required by this protocol wrapper.
pub fn with_options(io: IO, options: ConnectionOptions) -> ClientConnection<IO>
pub fn with_options(io: IO, options: ConnectionOptions) -> ClientConnection<IO>
Wrap an established stream with explicit bounds and parser policy.
The connection retains the extension store supplied by io.
pub fn is_reusable(&self) -> bool
pub fn is_reusable(&self) -> bool
Return whether another transaction may safely start.
pub const fn options(&self) -> &ConnectionOptions
pub const fn options(&self) -> &ConnectionOptions
Return the connection bounds and parser policy.
pub fn into_inner(self) -> IO
pub fn into_inner(self) -> IO
Recover the underlying stream.
Any bytes read ahead by the ICAP decoder are discarded. Use
into_parts to retain them.
pub fn into_parts(self) -> (IO, Bytes)
pub fn into_parts(self) -> (IO, Bytes)
Recover the underlying stream and bytes read ahead by the decoder.
§impl<IO> ClientConnection<IO>
impl<IO> ClientConnection<IO>
pub async fn start(
&mut self,
request: Request,
) -> Result<ClientTransaction<'_, IO>, Error>
pub async fn start( &mut self, request: Request, ) -> Result<ClientTransaction<'_, IO>, Error>
Start sending one ICAP request.
Trait Implementations§
§impl<IO> ExtensionsRef for ClientConnection<IO>
impl<IO> ExtensionsRef for ClientConnection<IO>
§fn extensions(&self) -> &Extensions
fn extensions(&self) -> &Extensions
Extensions storeAuto Trait Implementations§
impl<IO> !Freeze for ClientConnection<IO>
impl<IO> RefUnwindSafe for ClientConnection<IO>where
FramedIo<IO>: RefUnwindSafe,
impl<IO> Send for ClientConnection<IO>where
FramedIo<IO>: Send,
impl<IO> Sync for ClientConnection<IO>where
FramedIo<IO>: Sync,
impl<IO> Unpin for ClientConnection<IO>where
FramedIo<IO>: Unpin,
impl<IO> UnsafeUnpin for ClientConnection<IO>where
FramedIo<IO>: UnsafeUnpin,
impl<IO> UnwindSafe for ClientConnection<IO>where
FramedIo<IO>: 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
§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