mirror of
https://github.com/servo/servo.git
synced 2025-06-24 17:14:33 +01:00
Implement OptionalSettable for 'Cell<Option<JS<U>>>'.
This commit is contained in:
parent
b0239b5a5a
commit
92da2f16fc
1 changed files with 10 additions and 1 deletions
|
@ -47,7 +47,7 @@ use layout_interface::TrustedNodeAddress;
|
|||
use script_task::StackRoots;
|
||||
|
||||
use std::cast;
|
||||
use std::cell::RefCell;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::kinds::marker::ContravariantLifetime;
|
||||
|
||||
/// A type that represents a JS-owned value that is rooted for the lifetime of this value.
|
||||
|
@ -269,6 +269,15 @@ impl<T: Assignable<U>, U: Reflectable> OptionalSettable<T> for Option<JS<U>> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: Assignable<U>, U: Reflectable> OptionalSettable<T> for Cell<Option<JS<U>>> {
|
||||
fn assign(&mut self, val: Option<T>) {
|
||||
let mut item = self.get();
|
||||
item.assign(val);
|
||||
self.set(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Root a rootable Option type (used for Option<Temporary<T>>)
|
||||
pub trait OptionalRootable<T> {
|
||||
fn root<'a, 'b>(self) -> Option<Root<'a, 'b, T>>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue