Skip to main content

PropertyKey

Trait PropertyKey 

Source
pub trait PropertyKey: IntoWasmAbi + Sealed { }
Expand description

TypeScript’s PropertyKey: the key types accepted by JavaScript property operations and by TypeScript’s Record.

Marker for Rust parameter types represented by the TypeScript union number | string | symbol.

Use this trait as a bound on an experimental_generic_mono JavaScript import. Each monomorphisation retains its concrete ABI representation; this marker only restricts which Rust types may instantiate the parameter.

The union’s primitive categories use these Rust representations:

  • number: i8, u8, i16, u16, i32, u32, isize, usize, f32, f64, Number, and &Number
  • string: String, &str, &String, &Box<str>, &Cow<str>, JsString, and &JsString (the JsStringLike types)
  • symbol: Symbol and &Symbol

This trait is experimental and may change or be removed as experimental_generic_mono evolves.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl PropertyKey for &Box<str>

Source§

impl PropertyKey for &Cow<'_, str>

Source§

impl PropertyKey for &String

Source§

impl PropertyKey for &str

Source§

impl PropertyKey for String

Source§

impl PropertyKey for f32

Source§

impl PropertyKey for f64

Source§

impl PropertyKey for i8

Source§

impl PropertyKey for i16

Source§

impl PropertyKey for i32

Source§

impl PropertyKey for isize

Source§

impl PropertyKey for u8

Source§

impl PropertyKey for u16

Source§

impl PropertyKey for u32

Source§

impl PropertyKey for usize

Implementors§