nushell/crates/nu-system
Piepmatz 4b1f4e63c3
Replace std::time::Instant with web_time::Instant (#14668)
# Description
The `std::time::Instant` type panics in the WASM context. To prevent
this, I replaced all uses of `std::time::Instant` in WASM-relevant
crates with `web_time::Instant`. This ensures commands using `Instant`
work in WASM without issues. For non-WASM targets, `web-time` simply
reexports `std::time`, so this change doesn’t affect regular builds
([docs](https://docs.rs/web-time/latest/web_time/)).

To ensure future code doesn't reintroduce `std::time::Instant` in WASM
contexts, I added a `clippy wasm` command to the toolkit. This runs
`cargo clippy` with a `clippy.toml` configured to disallow
`std::time::Instant`. Since `web-time` aliases `std::time` by default,
the `clippy.toml` is stored in `clippy/wasm` and is only loaded when
targeting WASM. I also added a new CI job that tests this too.

# User-Facing Changes

None.
2024-12-25 16:50:02 +08:00
..
examples Reduce again the number of match calls (#7815) 2023-01-24 12:23:42 +01:00
src Replace std::time::Instant with web_time::Instant (#14668) 2024-12-25 16:50:02 +08:00
.gitignore Add nu-system and rewrite ps command (#734) 2022-01-14 17:20:53 +11:00
Cargo.toml Replace std::time::Instant with web_time::Instant (#14668) 2024-12-25 16:50:02 +08:00
LICENSE Nu glob (#4818) 2022-03-13 11:30:27 -07:00
README.md Add top-level crate documentation/READMEs (#12907) 2024-07-14 10:10:41 +02:00

Operating system specific bindings used by Nushell.

Currently primarily wrappers around processes and ways to gather process info from the system

Internal Nushell crate

This crate implements components of Nushell and is not designed to support plugin authors or other users directly.