mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Implement WebIDL codegen for ByteString.
This commit is contained in:
parent
541d581c32
commit
8c879c8bf8
6 changed files with 100 additions and 2 deletions
16
src/components/script/dom/bindings/str.rs
Normal file
16
src/components/script/dom/bindings/str.rs
Normal 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()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue