{"id":16883720,"url":"https://github.com/toku-sa-n/aligned_ptr","last_synced_at":"2025-03-20T05:16:10.720Z","repository":{"id":49771422,"uuid":"374961704","full_name":"toku-sa-n/aligned_ptr","owner":"toku-sa-n","description":"A Rust library that ensures a pointer is aligned correctly for dereferencing","archived":false,"fork":false,"pushed_at":"2021-06-10T01:25:34.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-28T04:30:09.993Z","etag":null,"topics":["pointer","rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/aligned_ptr","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/toku-sa-n.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-08T09:49:02.000Z","updated_at":"2021-06-10T01:25:36.000Z","dependencies_parsed_at":"2022-08-31T08:11:02.992Z","dependency_job_id":null,"html_url":"https://github.com/toku-sa-n/aligned_ptr","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toku-sa-n%2Faligned_ptr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toku-sa-n%2Faligned_ptr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toku-sa-n%2Faligned_ptr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toku-sa-n%2Faligned_ptr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toku-sa-n","download_url":"https://codeload.github.com/toku-sa-n/aligned_ptr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244554126,"owners_count":20471173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pointer","rust"],"created_at":"2024-10-13T16:14:03.664Z","updated_at":"2025-03-20T05:16:10.701Z","avatar_url":"https://github.com/toku-sa-n.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `aligned_ptr`\n\nA Rust library that ensures a pointer is aligned correctly before dereferencing it.\n\nThis library contains unsafe functions defined in `core::ptr` and `core::slice` (except `read_unaligned` and `write_unaligned`). All functions defined in this crate check whether the passed pointers are aligned correctly and not null.\n\nThis crate is intended to prevent from dereferencing to the unaligned address. For example the below code example panics because `p` points to an unaligned address. If we import `core::ptr` instead of `aligned_ptr::ptr`, this code may run successfully. However, reading a value from unaligned pointer causes *undefined behaviors* (except `read_unaligned`).\n\n```rust\nuse aligned_ptr::ptr;\n\nfn main() {\n    let x = 0xdeadbeaf_u32;\n    let p = (\u0026x as *const u32 as usize + 1) as *const u16;\n\n    unsafe { ptr::read(p) };\n}\n```\n\nThis crate supports the `no_std` environment.\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0\n   ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license\n   ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoku-sa-n%2Faligned_ptr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoku-sa-n%2Faligned_ptr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoku-sa-n%2Faligned_ptr/lists"}