Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I might have mis-interpreted this statement: "Certain types and traits that exist in the standard library are known to the Rust compiler." (https://doc.rust-lang.org/reference/special-types-and-traits...")


Out of those, Box is the only one that is, and the way that it is is not syntax: it has one exception, and that’s that you can move the contents out of it via a dereference. That’s making existing syntax semantically valid, not introducing new syntax.

In terms of syntax, you create a box with Box::new just like you might any other struct.

EDIT: anyway I'm not saying that means that your underlying issue isn't real, just that I think describing it as "syntax" makes the issue confusing to understand. It sounds to me like maybe you think Rust programs are too verbose?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: