Anders429 / Anders429/doc_item

Support use as inner attributes

Đang mở
#1 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Rust
Star
3
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Each attribute could potentially be used as an inner attribute.

```rust
#![doc_item::since("1.28.0")]
#![doc_item::docbox(content = "...")]
```

The above code block could be used at a crate-level to define crate-level `since` and `item-info` values.

As far as I can tell, the main challenge will be identifying whether the attribute is in an inner or outer position. The way to tell seems to be to check for `pub mod { ... }`. As I understand, `pub mod {}` is not valid in any other context, and is only wrapped around the full crate's code. As far as being used as an inner-attribute in other contexts, that may require more investigation surrounding what is passed in as the item `TokenStream`.

Note that this usage would require `nightly`, with [`custom_inner_attributes`](https://doc.rust-lang.org/beta/unstable-book/language-features/custom-inner-attributes.html) enabled.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.