crossbind
GitHub

Structs and enums

The public fields of a struct become properties, and every member of an enum is there by name.

await new Point() makes a Point with both fields at zero. A field is a property: await at.x reads it and at.x = 1 writes it. step takes the point by value, so C++ works on a copy and returns a new one.

The members of enum class Direction are Direction.North, Direction.East and so on, and they pass straight into C++. A field of a number, a bool or a std::string is a property; one of vector or class type needs accessor methods.

Try it
Walk the square the other way round. There is no turnLeft: call turnRight three times.
Open in playground
Runs without a compile until the C++, Rust, packages or imports change.
Press Run, or Ctrl+Enter, to run main.js.
Type to search every guide page and section.
↑↓ navigate↵ openesc close