Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Add impls for new std::io::{Read,Write} structs #172

Merged
merged 3 commits into from
Dec 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/input_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,17 @@ impl<O: IsA<InputStream> + IsA<glib::Object> + Clone + 'static> InputStreamExtMa
}
}

#[derive(Debug, PartialEq, Eq, Hash, Clone)]
pub struct InputStreamRead<T: InputStreamExtManual>(T);

impl <T: InputStreamExtManual> InputStreamRead<T> {
pub fn into_input_stream(self) -> T {
self.0
}

pub fn input_stream(&self) -> &T {
&self.0
}
}

impl <T: InputStreamExtManual> io::Read for InputStreamRead<T> {
Expand Down
5 changes: 5 additions & 0 deletions src/output_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,17 @@ impl<O: IsA<OutputStream> + IsA<glib::Object> + Clone + 'static> OutputStreamExt
}
}

#[derive(Debug, PartialEq, Eq, Hash, Clone)]
pub struct OutputStreamWrite<T: OutputStreamExt>(T);

impl <T: OutputStreamExt> OutputStreamWrite<T> {
pub fn into_output_stream(self) -> T {
self.0
}

pub fn output_stream(&self) -> &T {
&self.0
}
}

impl <T: OutputStreamExt> io::Write for OutputStreamWrite<T> {
Expand Down
2 changes: 2 additions & 0 deletions tests/std_io_copy.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(feature = "v2_36")]

extern crate glib;
extern crate gio;

Expand Down