mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Add LayoutJS<Node>::from_trusted_node_address()
This commit is contained in:
parent
8889041c19
commit
9f57fa17d0
3 changed files with 14 additions and 4 deletions
|
@ -191,6 +191,16 @@ impl JS<Node> {
|
|||
}
|
||||
}
|
||||
|
||||
impl LayoutJS<Node> {
|
||||
/// Create a new JS-owned value wrapped from an address known to be a `Node` pointer.
|
||||
pub unsafe fn from_trusted_node_address(inner: TrustedNodeAddress) -> LayoutJS<Node> {
|
||||
let TrustedNodeAddress(addr) = inner;
|
||||
LayoutJS {
|
||||
ptr: NonZero::new(addr as *const Node)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Reflectable> JS<T> {
|
||||
/// Create a new JS-owned value wrapped from a raw Rust pointer.
|
||||
pub unsafe fn from_raw(raw: *const T) -> JS<T> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue