mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Use raw::Slice where it makes sense.
This commit is contained in:
parent
b5d41aa8a5
commit
cba3b6806e
1 changed files with 5 additions and 2 deletions
|
@ -36,6 +36,7 @@ use std::boxed;
|
|||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use std::raw;
|
||||
|
||||
pub trait CefWrap<CObject> {
|
||||
fn to_c(rust_object: Self) -> CObject;
|
||||
|
@ -196,8 +197,10 @@ impl<'a> CefWrap<*const cef_string_t> for &'a [u16] {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(cef_string: *const cef_string_t) -> &'a [u16] {
|
||||
let (ptr, len): (*mut c_ushort, uint) = ((*cef_string).str, (*cef_string).length as uint);
|
||||
mem::transmute((ptr, len))
|
||||
mem::transmute(raw::Slice {
|
||||
data: (*cef_string).str,
|
||||
len: (*cef_string).length as usize,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue