[−][src]Struct sapp_jsutils::JsObject
Pointer type for Js allocated object Consider this as a Box, but pointing into JS memory -1 is nil
Implementations
impl JsObject
[src]
pub fn weak(&self) -> JsObjectWeak
[src]
Get a weak reference to js memory No guarantees against js garbage collector
impl JsObject
[src]
pub fn string(string: &str) -> JsObject
[src]
Allocate new javascript object with string type
pub fn buffer(data: &[u8]) -> JsObject
[src]
Allocate new javascript object with Uint8Array type
pub fn object() -> JsObject
[src]
Allocate new javascript object with object type. Like "var object = {}" in JS.
pub fn to_string(&self, buf: &mut String)
[src]
Read JS object content to a given string Will panic if object is not a string Will not allocate memory if string is large enough, will use "String::reserve" otherwise
pub fn to_byte_buffer(&self, buf: &mut Vec<u8>)
[src]
Read JS object content to a given bytes buffer Will panic if object is not a buffer Will use .resize() on "buf", so if "buf" is large enough - no memory is going to be allocated here
pub fn field(&self, field: &str) -> JsObject
[src]
Get a new JsObject from this object .field Will panic if self is not an object or map
pub fn set_field_f32(&self, field: &str, data: f32)
[src]
Set .field or ["field"] to given f32, like "object.field = data"; Will panic if self is not an object or map
pub fn is_nil(&self) -> bool
[src]
JS function returning JsObject may return -1 instead. Those JsObject are considering nil and if function may do this JsObjects should be checked for nil. Unfortunately this is not typecheked by rust complier at all, so any "f() -> JsObject" function may return nil
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for JsObject
[src]
impl Send for JsObject
[src]
impl Sync for JsObject
[src]
impl Unpin for JsObject
[src]
impl UnwindSafe for JsObject
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,