Add string-consuming writer to admin context interface.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -23,14 +23,12 @@ impl Context<'_> {
|
|||||||
arguments: fmt::Arguments<'_>,
|
arguments: fmt::Arguments<'_>,
|
||||||
) -> impl Future<Output = Result> + Send + '_ + use<'_> {
|
) -> impl Future<Output = Result> + Send + '_ + use<'_> {
|
||||||
let buf = format!("{arguments}");
|
let buf = format!("{arguments}");
|
||||||
self.output.lock().then(async move |mut output| {
|
self.write_string(buf)
|
||||||
output
|
|
||||||
.write_all(buf.as_bytes())
|
|
||||||
.map_err(Into::into)
|
|
||||||
.await
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub(crate) async fn write_string(&self, s: String) -> Result { self.write_str(&s).await }
|
||||||
|
|
||||||
pub(crate) fn write_str<'a>(
|
pub(crate) fn write_str<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
s: &'a str,
|
s: &'a str,
|
||||||
|
|||||||
Reference in New Issue
Block a user