aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/bindings/str.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/script/dom/bindings/str.rs')
-rw-r--r--src/components/script/dom/bindings/str.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/components/script/dom/bindings/str.rs b/src/components/script/dom/bindings/str.rs
new file mode 100644
index 00000000000..b7978b4737b
--- /dev/null
+++ b/src/components/script/dom/bindings/str.rs
@@ -0,0 +1,16 @@
+/* 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/. */
+
+pub struct ByteString(Vec<u8>);
+
+impl ByteString {
+ pub fn new(value: Vec<u8>) -> ByteString {
+ ByteString(value)
+ }
+
+ pub fn as_slice<'a>(&'a self) -> &'a [u8] {
+ let ByteString(ref vector) = *self;
+ vector.as_slice()
+ }
+}