summaryrefslogtreecommitdiffstats
path: root/dom/fs/parent/rust/data-encoding-ffi/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'dom/fs/parent/rust/data-encoding-ffi/src/lib.rs')
-rw-r--r--dom/fs/parent/rust/data-encoding-ffi/src/lib.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/dom/fs/parent/rust/data-encoding-ffi/src/lib.rs b/dom/fs/parent/rust/data-encoding-ffi/src/lib.rs
new file mode 100644
index 0000000000..74900b62ae
--- /dev/null
+++ b/dom/fs/parent/rust/data-encoding-ffi/src/lib.rs
@@ -0,0 +1,14 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+extern crate data_encoding;
+extern crate nsstring;
+
+use data_encoding::BASE32;
+use nsstring::{nsACString, nsCString};
+
+#[no_mangle]
+pub extern "C" fn base32encode(unencoded: &nsACString, encoded: &mut nsCString) {
+ encoded.assign(&BASE32.encode(&unencoded[..]));
+}