[librsvg/wip/rust-api: 5/5] LoadOptions: add a read_stream() method



commit 46c97e794d2a170dade854443339a50097dfc301
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Feb 18 10:57:04 2019 -0600

    LoadOptions: add a read_stream() method

 librsvg_crate/src/lib.rs | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/librsvg_crate/src/lib.rs b/librsvg_crate/src/lib.rs
index 17c92d10..6f5a8a88 100644
--- a/librsvg_crate/src/lib.rs
+++ b/librsvg_crate/src/lib.rs
@@ -92,8 +92,17 @@ impl LoadOptions {
     ) -> Result<SvgHandle, LoadingError> {
         let stream = file.read(None)?;
 
+        self.read_stream(&stream.upcast(), Some(&file), cancellable.into())
+    }
+
+    pub fn read_stream<'a, P: Into<Option<&'a Cancellable>>>(
+        self,
+        stream: &gio::InputStream,
+        base_file: Option<&gio::File>,
+        cancellable: P,
+    ) -> Result<SvgHandle, LoadingError> {
         let mut handle = Handle::new_with_flags(self.load_flags());
-        handle.construct_read_stream_sync(&stream.upcast(), Some(&file), cancellable.into())?;
+        handle.construct_read_stream_sync(stream, base_file, cancellable.into())?;
 
         Ok(SvgHandle(handle))
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]