Implement WebIDL codegen for ByteString.

This commit is contained in:
Ms2ger 2014-05-01 22:02:53 +02:00
parent 541d581c32
commit 8c879c8bf8
6 changed files with 100 additions and 2 deletions

View file

@ -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()
}
}