gio: Add Send implementation to IOStreamAsyncReadWrite

This is a wrapper for GSocketConnection, which should be OK to share across
threads.
pull/34/head
Philippe Normand 5 years ago
parent be8e9d898d
commit 2046eb2196
  1. 2
      src/gio.rs
  2. 4
      src/lib.rs

@ -68,6 +68,8 @@ pub struct IOStreamAsyncReadWrite<T: IsA<gio::IOStream>> {
write: gio::OutputStreamAsyncWrite<gio::PollableOutputStream>, write: gio::OutputStreamAsyncWrite<gio::PollableOutputStream>,
} }
unsafe impl<T: IsA<gio::IOStream>> Send for IOStreamAsyncReadWrite<T> {}
impl<T: IsA<gio::IOStream>> IOStreamAsyncReadWrite<T> { impl<T: IsA<gio::IOStream>> IOStreamAsyncReadWrite<T> {
/// Create a new `gio::IOStream` adapter /// Create a new `gio::IOStream` adapter
pub fn new(stream: T) -> Result<IOStreamAsyncReadWrite<T>, T> { pub fn new(stream: T) -> Result<IOStreamAsyncReadWrite<T>, T> {

@ -31,7 +31,6 @@
unused_imports, unused_imports,
unused_import_braces unused_import_braces
)] )]
#![forbid(unsafe_code)]
pub use tungstenite; pub use tungstenite;
@ -272,8 +271,7 @@ impl<S> WebSocketStream<S> {
} }
/// Returns a reference to the configuration of the tungstenite stream. /// Returns a reference to the configuration of the tungstenite stream.
pub fn get_config(&self) -> &WebSocketConfig pub fn get_config(&self) -> &WebSocketConfig {
{
self.inner.get_config() self.inner.get_config()
} }

Loading…
Cancel
Save