1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use chakracore_sys::*;
use context::ContextGuard;
use super::Value;
pub struct Boolean(JsValueRef);
impl Boolean {
pub fn new(_guard: &ContextGuard, boolean: bool) -> Self {
let mut value = JsValueRef::new();
unsafe {
jsassert!(JsBoolToBoolean(boolean, &mut value));
Self::from_raw(value)
}
}
pub fn value(&self) -> bool {
let mut boolean = false;
jsassert!(unsafe { JsBooleanToBool(self.as_raw(), &mut boolean) });
boolean
}
is_same!(Boolean, "Returns true if the value is a `Boolean`.");
}
reference!(Boolean);
inherit!(Boolean, Value);