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