dtolnay/cxx

Improvements to namespace support

开放

#353 创建于 2020年10月10日

 (16 条评论) (0 个反应) (0 位负责人)Rust (253 个派生)batch import
help wanted

仓库指标

星标
 (4,472 个星标)
PR 合并指标
 (平均合并 8分钟) (30 天内合并 3 个 PR)

描述

This issue is just to track the implementation plan laid out at the bottom of https://github.com/dtolnay/cxx/pull/298#issuecomment-703817493.

  • Emit all mentions of a type in generated C++ code (in function arguments and so forth) as a fully qualified path ::name::space::of::Type, even if it currently always happens to be within the same module. #370

  • Store a distinct Namespace on each FFI item rather than having a single global namespace for the whole code generation. #370

  • Implement #[namespace = ...] attribute to determine namespace of individual items. #370 #380

  • Implement hierarchical handling of namespace which prioritizes item-level attribute > extern block > module. #444

  • Emit ExternType impls for shared structs. #341

  • Safe ExternType derive for extern Rust items. extern "Rust" { #[derive(ExternType)] type TheType; } 16e2620fe51032d789770b489e27a9c6c27719ef

  • Permit use inside of cxx::bridge.

贡献者指南