[librsvg: 4/7] librsvg_crate: remove bool arguments from loader



commit 33021591f4d6bec1e144c3a6f86d311f6ee5487e
Author: Paolo Borelli <pborelli gnome org>
Date:   Sun Feb 24 19:08:32 2019 +0100

    librsvg_crate: remove bool arguments from loader
    
    The options are false by default, we just need methods to turn them
    on. Also change unlimited_size() to with_unlimited_size().

 librsvg_crate/src/lib.rs | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/librsvg_crate/src/lib.rs b/librsvg_crate/src/lib.rs
index 204b5d80..b3231d7b 100644
--- a/librsvg_crate/src/lib.rs
+++ b/librsvg_crate/src/lib.rs
@@ -129,7 +129,7 @@ pub struct Loader {
 impl Loader {
     /// Creates a `Loader` with the default flags.
     ///
-    /// * [`unlimited_size`](#method.unlimited_size) defaults to `false`, as malicious
+    /// * [`unlimited_size`](#method.with_unlimited_size) defaults to `false`, as malicious
     /// SVG files could cause the XML parser to consume very large amounts of memory.
     ///
     /// * [`keep_image_data`](#method.keep_image_data) defaults to
@@ -171,12 +171,12 @@ impl Loader {
     /// use librsvg::Loader;
     ///
     /// let svg_handle = Loader::new()
-    ///     .unlimited_size(true)
+    ///     .with_unlimited_size()
     ///     .read_path("trusted-huge-file.svg")
     ///     .unwrap();
     /// ```
-    pub fn unlimited_size(mut self, unlimited: bool) -> Self {
-        self.unlimited_size = unlimited;
+    pub fn with_unlimited_size(mut self) -> Self {
+        self.unlimited_size = true;
         self
     }
 
@@ -200,7 +200,7 @@ impl Loader {
     /// use librsvg::Loader;
     ///
     /// let svg_handle = Loader::new()
-    ///     .keep_image_data(true)
+    ///     .keep_image_data()
     ///     .read_path("svg-with-embedded-images.svg")
     ///     .unwrap();
     ///
@@ -210,8 +210,8 @@ impl Loader {
     /// let renderer = CairoRenderer::new(&svg_handle);
     /// renderer.render(&cr).unwrap();
     /// ```
-    pub fn keep_image_data(mut self, keep: bool) -> Self {
-        self.keep_image_data = keep;
+    pub fn keep_image_data(mut self) -> Self {
+        self.keep_image_data = true;
         self
     }
 


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