script::dom::bindings

Module conversions

source
Expand description

Conversions of Rust values to and from JSVal.

IDL typeArgument typeReturn type
anyJSVal
booleanbool
bytei8
octetu8
shorti16
unsigned shortu16
longi32
unsigned longu32
long longi64
unsigned long longu64
unrestricted floatf32
floatFinite<f32>
unrestricted doublef64
doubleFinite<f64>
DOMStringDOMString
USVStringUSVString
ByteStringByteString
object*mut JSObject
interface types&TDomRoot<T>
dictionary types&Tunsupported
enumeration typesT
callback function typesRc<T>
nullable typesOption<T>
sequencesVec<T>
union typesT

Enumsยง

Constantsยง

  • DOM_OBJECT_SLOT ๐Ÿ”’
    The index of the slot wherein a pointer to the reflected DOM object is stored for non-proxy bindings.

Traitsยง

  • DerivedFrom ๐Ÿ”’
    A trait to mark an IDL interface as deriving from another one.
  • A trait to convert JSVals to Rust types.
  • IDLInterface ๐Ÿ”’
    A trait to check whether a given JSObject implements an IDL interface.
  • ToJSValConvertible ๐Ÿ”’
    A trait to convert Rust types to JSVals.

Functionsยง

  • get_dom_class ๐Ÿ”’ โš 
    Get the DOMClass from obj, or Err(()) if obj is not a DOM object.
  • get_property ๐Ÿ”’ โš 
    Get a property from a JS object, and convert it to a Rust value.
  • get_property_jsval ๐Ÿ”’ โš 
    Get a property from a JS object.
  • is_array_like ๐Ÿ”’ โš 
    Returns whether value is an array-like object (Array, FileList, HTMLCollection, HTMLFormControlsCollection, HTMLOptionsCollection, NodeList).
  • is_dom_proxy ๐Ÿ”’
    Returns whether obj is a DOM object implemented as a proxy.
  • jsid_to_string ๐Ÿ”’ โš 
    Convert id to a DOMString. Returns None if id is not a string or integer.
  • jsstring_to_str ๐Ÿ”’ โš 
    Convert the given JSString to a DOMString. Fails if the string does not contain valid UTF-16.
  • Get a *const T for a DOM object accessible from a HandleValue. Caller is responsible for throwing a JS exception if needed in case of error.
  • native_from_object ๐Ÿ”’
    Get a *const T for a DOM object accessible from a JSObject.
  • Get a *const T for a DOM object accessible from a JSObject, where the DOM object is guaranteed not to be a wrapper.
  • private_from_object ๐Ÿ”’ โš 
    Get the private pointer of a DOM object from a given reflector.
  • private_from_proto_check ๐Ÿ”’ โš 
    Get a *const libc::c_void for the given DOM object, unwrapping any wrapper around it first, and checking if the object is of the correct type.
  • Get a *const libc::c_void for the given DOM object, unless it is a DOM wrapper, and checking if the object is of the correct type.
  • Get a DomRoot<T> for a DOM object accessible from a HandleObject.
  • Get a DomRoot<T> for a DOM object accessible from a HandleValue. Caller is responsible for throwing a JS exception if needed in case of error.
  • root_from_object ๐Ÿ”’
    Get a DomRoot<T> for the given DOM object, unwrapping any wrapper around it first, and checking if the object is of the correct type.
  • Get a DomRoot<T> for the given DOM object, unwrapping any wrapper around it first, and checking if the object is of the correct type.
  • windowproxy_from_handlevalue ๐Ÿ”’ โš 
    Get a DomRoot<T> for a WindowProxy accessible from a HandleValue. Caller is responsible for throwing a JS exception if needed in case of error.