Struct ResponseWriterLayer
pub struct ResponseWriterLayer<W> { /* private fields */ }http and std only.Expand description
Layer that applies ResponseWriterService which prints the http response in std format.
Response bodies are observed while they stream to the caller. The writer receives an owned body stream and processes frames concurrently.
Implementations§
§impl<W> ResponseWriterLayer<W>
impl<W> ResponseWriterLayer<W>
pub const fn new(writer: W) -> ResponseWriterLayer<W>
pub const fn new(writer: W) -> ResponseWriterLayer<W>
Create a new ResponseWriterLayer with a custom ResponseWriter.
Use Self::new_with_executor when streaming writer tasks must participate
in graceful shutdown.
pub const fn new_with_executor(
writer: W,
executor: Executor,
) -> ResponseWriterLayer<W>
pub const fn new_with_executor( writer: W, executor: Executor, ) -> ResponseWriterLayer<W>
Create a new ResponseWriterLayer with a custom ResponseWriter
and executor for streaming writer tasks.
§impl ResponseWriterLayer<UnboundedSender<Response>>
impl ResponseWriterLayer<UnboundedSender<Response>>
pub fn writer_unbounded<W>(
executor: &Executor,
writer: W,
mode: Option<WriterMode>,
) -> ResponseWriterLayer<UnboundedSender<Response>>
pub fn writer_unbounded<W>( executor: &Executor, writer: W, mode: Option<WriterMode>, ) -> ResponseWriterLayer<UnboundedSender<Response>>
Create a new ResponseWriterLayer that prints responses to an [AsyncWrite]r
over an unbounded channel
pub fn stdout_unbounded(
executor: &Executor,
mode: Option<WriterMode>,
) -> ResponseWriterLayer<UnboundedSender<Response>>
pub fn stdout_unbounded( executor: &Executor, mode: Option<WriterMode>, ) -> ResponseWriterLayer<UnboundedSender<Response>>
Create a new ResponseWriterLayer that prints responses to stdout
over an unbounded channel.
pub fn stderr_unbounded(
executor: &Executor,
mode: Option<WriterMode>,
) -> ResponseWriterLayer<UnboundedSender<Response>>
pub fn stderr_unbounded( executor: &Executor, mode: Option<WriterMode>, ) -> ResponseWriterLayer<UnboundedSender<Response>>
Create a new ResponseWriterLayer that prints responses to stderr
over an unbounded channel.
§impl ResponseWriterLayer<PerMessageFileWriter>
impl ResponseWriterLayer<PerMessageFileWriter>
pub async fn file_per_response(
executor: &Executor,
directory: impl Into<PathBuf>,
prefix: impl AsRef<str>,
mode: Option<WriterMode>,
) -> Result<ResponseWriterLayer<PerMessageFileWriter>, Error>
pub async fn file_per_response( executor: &Executor, directory: impl Into<PathBuf>, prefix: impl AsRef<str>, mode: Option<WriterMode>, ) -> Result<ResponseWriterLayer<PerMessageFileWriter>, Error>
Create a layer that streams every response into a unique file below
directory using the portable filename prefix.
§impl ResponseWriterLayer<Sender<Response>>
impl ResponseWriterLayer<Sender<Response>>
pub fn writer<W>(
executor: &Executor,
writer: W,
buffer_size: usize,
mode: Option<WriterMode>,
) -> ResponseWriterLayer<Sender<Response>>
pub fn writer<W>( executor: &Executor, writer: W, buffer_size: usize, mode: Option<WriterMode>, ) -> ResponseWriterLayer<Sender<Response>>
Create a new ResponseWriterLayer that prints responses to an [AsyncWrite]r
over a bounded channel with a fixed buffer size.
pub fn stdout(
executor: &Executor,
buffer_size: usize,
mode: Option<WriterMode>,
) -> ResponseWriterLayer<Sender<Response>>
pub fn stdout( executor: &Executor, buffer_size: usize, mode: Option<WriterMode>, ) -> ResponseWriterLayer<Sender<Response>>
Create a new ResponseWriterLayer that prints responses to stdout
over a bounded channel with a fixed buffer size.
pub fn stderr(
executor: &Executor,
buffer_size: usize,
mode: Option<WriterMode>,
) -> ResponseWriterLayer<Sender<Response>>
pub fn stderr( executor: &Executor, buffer_size: usize, mode: Option<WriterMode>, ) -> ResponseWriterLayer<Sender<Response>>
Create a new ResponseWriterLayer that prints responses to stderr
over a bounded channel with a fixed buffer size.
Trait Implementations§
§impl<W> Clone for ResponseWriterLayer<W>where
W: Clone,
impl<W> Clone for ResponseWriterLayer<W>where
W: Clone,
§fn clone(&self) -> ResponseWriterLayer<W>
fn clone(&self) -> ResponseWriterLayer<W>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl<W> Debug for ResponseWriterLayer<W>
impl<W> Debug for ResponseWriterLayer<W>
§impl<S, W> Layer<S> for ResponseWriterLayer<W>where
W: Clone,
impl<S, W> Layer<S> for ResponseWriterLayer<W>where
W: Clone,
§type Service = ResponseWriterService<S, W>
type Service = ResponseWriterService<S, W>
§fn layer(&self, inner: S) -> <ResponseWriterLayer<W> as Layer<S>>::Service
fn layer(&self, inner: S) -> <ResponseWriterLayer<W> as Layer<S>>::Service
§fn into_layer(self, inner: S) -> <ResponseWriterLayer<W> as Layer<S>>::Service
fn into_layer(self, inner: S) -> <ResponseWriterLayer<W> as Layer<S>>::Service
layer but consuming self after the service was created. Read moreAuto Trait Implementations§
impl<W> Freeze for ResponseWriterLayer<W>where
W: Freeze,
impl<W> RefUnwindSafe for ResponseWriterLayer<W>where
W: RefUnwindSafe,
impl<W> Send for ResponseWriterLayer<W>where
W: Send,
impl<W> Sync for ResponseWriterLayer<W>where
W: Sync,
impl<W> Unpin for ResponseWriterLayer<W>where
W: Unpin,
impl<W> UnsafeUnpin for ResponseWriterLayer<W>where
W: UnsafeUnpin,
impl<W> UnwindSafe for ResponseWriterLayer<W>where
W: 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