|
Yeah, if you enable the "serde-serialize" feature in wasm-bindgen then you can pass anything that serde can serialize to JSON across the WASM boundary. For example you can docode:
|
# ¿ May 22, 2018 00:08 |
|
|
# ¿ Apr 29, 2024 20:37 |
|
The wasm32-unknown-unknown target is available on stable Rust now, so there's no need for the setup process to involve installing nightly anymore (unless you're using other nightly features)
|
# ¿ Dec 13, 2018 18:47 |
|
Sounds like you want mem::swapcode:
|
# ¿ Jun 22, 2019 14:11 |
|
The standard library has both - mem::swap/mem::replace do it safely through references, and ptr::swap/ptr::replace do it unsafely through raw pointers.
|
# ¿ Jun 22, 2019 22:58 |
|
Measly Twerp posted:For example, if you've ever tried to implement a tree data type in rust, you know it's not as easy as in a memory managed language, especially so if you need the children to know what their parent nodes are. Arenas are another option provided you don't need to drop individual nodes. Nodes allocated from the same arena all have the same lifetime, so they can freely hold references to each other, circular references, whatever, the compiler doesn't care as long as the arena lives long enough. e.g. https://docs.rs/typed-arena/1.4.1/typed_arena/#safe-cycles repiv fucked around with this message at 15:39 on Jul 13, 2019 |
# ¿ Jul 13, 2019 15:36 |
|
It might be worth reporting that, the Rust team generally treats unhelpful error messages as bugs.
|
# ¿ Dec 7, 2019 11:15 |
|
Large arrays are just annoying to work with right now, the compiler will usually elide the temporary stack allocation in release builds but it's hard to keep your debug builds from blowing up. I think the "box" keyword is supposed to fix that eventually. If you really want to use arrays and only care about storing zeroable POD types like f32 then the bytemuck crate has a helper that can construct a Box<[T; N]> without an intermediate stack allocation in the meantime https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=33d0630c79f834949a8d3d22e8c7c01e That works for anything implementing bytemucks Zeroable trait, which can be derived on your own types too if all their fields are also Zeroable repiv fucked around with this message at 22:53 on May 19, 2022 |
# ¿ May 19, 2022 22:44 |
|
It feels like you should just be able to do Box::default() for that really, but Default is still only implemented for arrays up to 32 long Not sure why there isn't a const-generic implementation of Default for any length array yet
|
# ¿ May 19, 2022 22:59 |
|
gonadic io posted:oh speaking of, new rust twitter drama hit this morning https://docs.google.com/document/d/1ErZlwz9bbSI43dNo-rgQdkovm2h5ycuW220mWSOAuok/edit seems like more drama has been brewing, one of the four members of the core team just resigned outright https://twitter.com/jntrnr/status/1662229886386442242
|
# ¿ May 27, 2023 01:10 |
|
|
# ¿ Apr 29, 2024 20:37 |
|
on windows rust uses the MSVC linker so i guess there might be something similar on mac where it needs the native tools to put the executable together
|
# ¿ Apr 10, 2024 19:21 |