aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/bindings/str.rs
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2014-05-01 22:02:53 +0200
committerMs2ger <ms2ger@gmail.com>2014-05-01 22:02:53 +0200
commit8c879c8bf8c7ab9938307c252ca74baf2c845631 (patch)
tree518c69cb01e5685535b602a1594c5023314dcd2a /src/components/script/dom/bindings/str.rs
parent541d581c3295c976adfaf28070d20f08773c7cb3 (diff)
downloadservo-8c879c8bf8c7ab9938307c252ca74baf2c845631.tar.gz
servo-8c879c8bf8c7ab9938307c252ca74baf2c845631.zip
Implement WebIDL codegen for ByteString.
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()
+ }
+}