Skip to content

Commit

Permalink
io: implemented get_ref and get_mut for SyncIoBridge
Browse files Browse the repository at this point in the history
  • Loading branch information
ow committed Jan 27, 2025
1 parent 7f09959 commit e73d252
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tokio-util/src/io/sync_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,18 @@ impl<T: Unpin> SyncIoBridge<T> {
pub fn into_inner(self) -> T {
self.src
}

/// Returns a shared reference to the inner resource.
///
/// It is inadvisable to directly read/write from the underlying resource.
pub fn get_ref(&self) -> &T {
&self.src
}

/// Returns a mutable reference to the inner resource.
///
/// It is inadvisable to directly read/write from the underlying resource.
pub fn get_mut(&mut self) -> &T {
&mut self.src
}
}

0 comments on commit e73d252

Please sign in to comment.