@@ -36,23 +36,48 @@ where
36
36
37
37
/// Sets the read timeout.
38
38
///
39
- /// This will reset any pending read timeout.
39
+ /// This can only be used before the stream is pinned; use
40
+ /// [`set_read_timeout_pinned`](Self::set_read_timeout_pinned) otherwise.
40
41
pub fn set_read_timeout ( & mut self , timeout : Option < Duration > ) {
41
42
self . stream . set_read_timeout ( timeout)
42
43
}
43
44
45
+ /// Sets the read timeout.
46
+ ///
47
+ /// This will reset any pending read timeout. Use
48
+ /// [`set_read_timeout`](Self::set_read_timeout) instead if the stream has not yet been pinned.
49
+ pub fn set_read_timeout_pinned ( self : Pin < & mut Self > , timeout : Option < Duration > ) {
50
+ self . project ( )
51
+ . stream
52
+ . as_mut ( )
53
+ . set_read_timeout_pinned ( timeout)
54
+ }
55
+
44
56
/// Returns the current write timeout.
45
57
pub fn write_timeout ( & self ) -> Option < Duration > {
46
58
self . stream . write_timeout ( )
47
59
}
48
60
49
61
/// Sets the write timeout.
50
62
///
51
- /// This will reset any pending write timeout.
63
+ /// This can only be used before the stream is pinned; use
64
+ /// [`set_write_timeout_pinned`](Self::set_write_timeout_pinned) otherwise.
52
65
pub fn set_write_timeout ( & mut self , timeout : Option < Duration > ) {
53
66
self . stream . set_write_timeout ( timeout)
54
67
}
55
68
69
+ /// Sets the write timeout.
70
+ ///
71
+ /// This will reset any pending write timeout. Use
72
+ /// [`set_write_timeout`](Self::set_write_timeout) instead if the stream has not yet been
73
+ /// pinned.
74
+ pub fn set_write_timeout_pinned ( self : Pin < & mut Self > , timeout : Option < Duration > ) {
75
+ self . project ( )
76
+ . stream
77
+ . as_mut ( )
78
+ . set_write_timeout_pinned ( timeout)
79
+ }
80
+
56
81
/// Returns a shared reference to the inner stream.
57
82
pub fn get_ref ( & self ) -> & S {
58
83
self . stream . get_ref ( )
63
88
self . stream . get_mut ( )
64
89
}
65
90
91
+ /// Returns a pinned mutable reference to the inner stream.
92
+ pub fn get_pin_mut ( self : Pin < & mut Self > ) -> Pin < & mut S > {
93
+ self . project ( ) . stream . get_pin_mut ( )
94
+ }
95
+
66
96
/// Consumes the stream, returning the inner stream.
67
97
pub fn into_inner ( self ) -> S {
68
98
self . stream . into_inner ( )
0 commit comments