crossbind
GitHub

Rust

A .rs file imports like a header: crossbind binds its public structs and functions, so Rust sits beside C++ in one project.

words.rs defines a struct, Tally, with its methods in an impl, and a function, parse_score. The struct arrives as a class whose constructor is new, and snake_case names arrive in camelCase: parseScore.

A String is a string and a Vec an array, with no helper, and None is null. A function that returns a Result returns what Ok holds and throws an Err as an Error with the error's text.

A crate from crates.io imports the same way, as cargo:<crate>; the next step uses one, and the Rust guide maps every type.

Try it
Give Tally a pub fn shortest(&self) -> Option<String> and print tally.shortest().
Open in playgroundRuns without a compile until the C++, Rust, packages or imports change.
Console
Press Run, or Ctrl+Enter, to run main.js.
Type to search every guide page and section.
↑↓ navigate↵ openesc close