From 61d08f0af983acddc5fbbefa441f1673d3438157 Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Sun, 27 Aug 2017 23:49:43 +0000 Subject: [PATCH] Added a method to Rust library. --- rust/src/lib.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 655a179..bccce29 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -217,6 +217,33 @@ impl QrCode { } + pub fn to_svg_string(&self, border: i32) -> String { + assert!(border >= 0, "Border must be non-negative"); + let mut result: String = String::new(); + result.push_str("\n"); + result.push_str("\n"); + result.push_str(&format!("\n", self.size + border * 2)); + result.push_str("\t\n"); + result.push_str("\t\n"); + result.push_str("\n"); + result + } + + /*---- Private helper methods for constructor: Drawing function modules ----*/ fn draw_function_patterns(&mut self) {