@@ -71,6 +71,8 @@ impl IoToken {
7171 /// receive further notifications it will need to call `schedule_read`
7272 /// again.
7373 ///
74+ /// This function returns an error if reactor is destroyed.
75+ ///
7476 /// > **Note**: This method should generally not be used directly, but
7577 /// > rather the `ReadinessStream` type should be used instead.
7678 ///
@@ -82,8 +84,8 @@ impl IoToken {
8284 ///
8385 /// This function will also panic if there is not a currently running future
8486 /// task.
85- pub fn schedule_read ( & self , handle : & Remote ) {
86- handle. send ( Message :: Schedule ( self . token , task:: park ( ) , Direction :: Read ) ) ;
87+ pub fn schedule_read ( & self , handle : & Remote ) -> io :: Result < ( ) > {
88+ handle. send ( Message :: Schedule ( self . token , task:: park ( ) , Direction :: Read ) )
8789 }
8890
8991 /// Schedule the current future task to receive a notification when the
@@ -98,6 +100,8 @@ impl IoToken {
98100 /// receive further notifications it will need to call `schedule_write`
99101 /// again.
100102 ///
103+ /// This function returns an error if reactor is destroyed.
104+ ///
101105 /// > **Note**: This method should generally not be used directly, but
102106 /// > rather the `ReadinessStream` type should be used instead.
103107 ///
@@ -109,8 +113,8 @@ impl IoToken {
109113 ///
110114 /// This function will also panic if there is not a currently running future
111115 /// task.
112- pub fn schedule_write ( & self , handle : & Remote ) {
113- handle. send ( Message :: Schedule ( self . token , task:: park ( ) , Direction :: Write ) ) ;
116+ pub fn schedule_write ( & self , handle : & Remote ) -> io :: Result < ( ) > {
117+ handle. send ( Message :: Schedule ( self . token , task:: park ( ) , Direction :: Write ) )
114118 }
115119
116120 /// Unregister all information associated with a token on an event loop,
@@ -127,6 +131,8 @@ impl IoToken {
127131 /// ensure that the callbacks are **not** invoked, so pending scheduled
128132 /// callbacks cannot be relied upon to get called.
129133 ///
134+ /// This function returns an error if reactor is destroyed.
135+ ///
130136 /// > **Note**: This method should generally not be used directly, but
131137 /// > rather the `ReadinessStream` type should be used instead.
132138 ///
@@ -135,7 +141,7 @@ impl IoToken {
135141 /// This function will panic if the event loop this handle is associated
136142 /// with has gone away, or if there is an error communicating with the event
137143 /// loop.
138- pub fn drop_source ( & self , handle : & Remote ) {
139- handle. send ( Message :: DropSource ( self . token ) ) ;
144+ pub fn drop_source ( & self , handle : & Remote ) -> io :: Result < ( ) > {
145+ handle. send ( Message :: DropSource ( self . token ) )
140146 }
141147}
0 commit comments