Skip to content

Commit d2d0058

Browse files
feat: make ChannelWriteHalf::make_writer[_ext] public, fix #498 (#499)
Fix #498
1 parent 095fc68 commit d2d0058

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

russh/src/channels/mod.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,15 @@ impl<S: From<(ChannelId, ChannelMsg)> + Send + Sync + 'static> ChannelWriteHalf<
338338
.map_err(|_| Error::SendError)
339339
}
340340

341+
/// Make a writer for the [`Channel`] to send [`ChannelMsg::Data`]
342+
/// through the `AsyncWrite` trait.
343+
pub fn make_writer(&self) -> impl AsyncWrite {
344+
self.make_writer_ext(None)
345+
}
346+
341347
/// Make a writer for the [`Channel`] to send [`ChannelMsg::Data`] or [`ChannelMsg::ExtendedData`]
342348
/// depending on the `ext` parameter, through the `AsyncWrite` trait.
343-
fn make_writer_ext(&self, ext: Option<u32>) -> impl AsyncWrite {
349+
pub fn make_writer_ext(&self, ext: Option<u32>) -> impl AsyncWrite {
344350
io::ChannelTx::new(
345351
self.sender.clone(),
346352
self.id,
@@ -583,7 +589,7 @@ impl<S: From<(ChannelId, ChannelMsg)> + Send + Sync + 'static> Channel<S> {
583589
/// Make a writer for the [`Channel`] to send [`ChannelMsg::Data`]
584590
/// through the `AsyncWrite` trait.
585591
pub fn make_writer(&self) -> impl AsyncWrite {
586-
self.make_writer_ext(None)
592+
self.write_half.make_writer()
587593
}
588594

589595
/// Make a writer for the [`Channel`] to send [`ChannelMsg::Data`] or [`ChannelMsg::ExtendedData`]

0 commit comments

Comments
 (0)