{"id":16687777,"url":"https://github.com/alecmocatta/metatype","last_synced_at":"2025-04-10T00:32:35.296Z","repository":{"id":48815221,"uuid":"141729647","full_name":"alecmocatta/metatype","owner":"alecmocatta","description":"Helper methods to work with Rust types.","archived":false,"fork":false,"pushed_at":"2025-03-19T16:47:59.000Z","size":50,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-19T17:38:56.687Z","etag":null,"topics":["rust","slice","trait-object","types","vtable"],"latest_commit_sha":null,"homepage":"","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/alecmocatta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-20T15:37:31.000Z","updated_at":"2025-03-19T16:45:40.000Z","dependencies_parsed_at":"2022-09-26T20:21:14.912Z","dependency_job_id":null,"html_url":"https://github.com/alecmocatta/metatype","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecmocatta%2Fmetatype","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecmocatta%2Fmetatype/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecmocatta%2Fmetatype/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecmocatta%2Fmetatype/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alecmocatta","download_url":"https://codeload.github.com/alecmocatta/metatype/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248135357,"owners_count":21053663,"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":["rust","slice","trait-object","types","vtable"],"created_at":"2024-10-12T15:24:59.204Z","updated_at":"2025-04-10T00:32:35.289Z","avatar_url":"https://github.com/alecmocatta.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# metatype\n\n[![Crates.io](https://img.shields.io/crates/v/metatype.svg?maxAge=86400)](https://crates.io/crates/metatype)\n[![MIT / Apache 2.0 licensed](https://img.shields.io/crates/l/metatype.svg?maxAge=2592000)](#License)\n[![Build Status](https://dev.azure.com/alecmocatta/metatype/_apis/build/status/tests?branchName=master)](https://dev.azure.com/alecmocatta/metatype/_build?definitionId=7)\n\n[📖 Docs](https://docs.rs/metatype/0.2) | [💬 Chat](https://constellation.zulipchat.com/#narrow/stream/213236-subprojects)\n\nHelper methods to determine whether a type is `TraitObject`, `Slice` or `Concrete`, and work with them respectively.\n\n## Examples\n\n```rust\nassert_eq!(usize::METATYPE, MetaType::Concrete);\nassert_eq!(any::Any::METATYPE, MetaType::TraitObject);\nassert_eq!(\u003c[u8]\u003e::METATYPE, MetaType::Slice);\n\nlet a: Box\u003cusize\u003e = Box::new(123);\nassert_eq!(Type::meta_type(\u0026*a), MetaType::Concrete);\nlet a: Box\u003cdyn any::Any\u003e = a;\nassert_eq!(Type::meta_type(\u0026*a), MetaType::TraitObject);\n\nlet a = [123,456];\nassert_eq!(Type::meta_type(\u0026a), MetaType::Concrete);\nlet a: \u0026[i32] = \u0026a;\nassert_eq!(Type::meta_type(a), MetaType::Slice);\n\nlet a: Box\u003cdyn any::Any\u003e = Box::new(123);\nlet meta: TraitObject = type_coerce(Type::meta(\u0026*a));\nprintln!(\"vtable: {:?}\", meta.vtable);\n```\n\n## Note\n\nThis currently requires Rust nightly for the `ptr_metadata`, `specialization` and `arbitrary_self_types_pointers` features.\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0, ([LICENSE-APACHE.txt](LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT.txt](LICENSE-MIT.txt) or http://opensource.org/licenses/MIT)\n\nat your option.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecmocatta%2Fmetatype","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falecmocatta%2Fmetatype","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecmocatta%2Fmetatype/lists"}