https://github.com/tyilo/platform-cast
https://github.com/tyilo/platform-cast
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tyilo/platform-cast
- Owner: tyilo
- License: apache-2.0
- Created: 2025-05-14T14:17:49.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-05-14T14:19:03.000Z (about 1 year ago)
- Last Synced: 2025-11-27T09:11:02.583Z (7 months ago)
- Language: Rust
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# platform-cast [![Latest Version]][crates.io] [![API Docs]][docs.rs]
[Latest Version]: https://img.shields.io/crates/v/platform-cast.svg
[crates.io]: https://crates.io/crates/platform-cast
[API Docs]: https://img.shields.io/docsrs/platform-cast.svg
[docs.rs]: https://docs.rs/platform-cast
Platform-specific safe cast.
| | `From` | `TryFrom` | `as` cast | `CastFrom` |
| ------------------------- | -------- | ----------- | --------- | ---------- |
| No runtime check | ✅ | ❌ | ✅ | ✅ |
| `usize` <-> `u64`[^a] | ❌ | ✅ | ✅ | ✅ |
| No truncation | ✅ | ✅ | ❌ | ✅ |
| No change of sign | ✅ | ✅ | ❌ | ✅ |
[^a]: Assuming a target with a pointer width of 64.