Module mozjs::conversions[][src]

Expand description

Conversions of Rust values to and from JSVal.

IDL typeType
anyJSVal
booleanbool
bytei8
octetu8
shorti16
unsigned shortu16
longi32
unsigned longu32
long longi64
unsigned long longu64
unrestricted floatf32
floatFinite<f32>
unrestricted doublef64
doubleFinite<f64>
USVStringString
object*mut JSObject
nullable typesOption<T>
sequencesVec<T>

Structs

Rooting guard for the iterator field of ForOfIterator. Behaves like RootedGuard (roots on creation, unroots on drop), but borrows and allows access to the whole ForOfIterator, so that methods on ForOfIterator can still be used through it.

Enums

Behavior for converting out-of-range integers.

An enum to better support enums through FromJSValConvertible::from_jsval.

Traits

A trait to convert JSVals to Rust types.

A trait to convert Rust types to JSVals.

Functions

Try to cast the number to a smaller type, but if it doesn’t fit, round it to the MAX or MIN of the source type before casting it to the destination type.

Try to cast the number to a smaller type, but if it doesn’t fit, it will return an error.

Converts a JSString into a String, regardless of used encoding.

Converts a JSString, encoded in “Latin1” (i.e. U+0000-U+00FF encoded as 0x00-0xFF) into a String.