Skip to content

Commit

Permalink
add: lib.rs 网站新功能一览
Browse files Browse the repository at this point in the history
  • Loading branch information
zjp-CN committed Aug 18, 2023
1 parent 0deb4ec commit 584c70b
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
- [如何理解生命周期与型变]()
- [静态生命周期提升](./forum/static-promotion.md)
- [`+=` 运算符与 MIR 应用](./forum/addassgin.md)
- [lib.rs 网站新功能一览](./forum/lib.rs.md)
- [赏析 PR/issue](./learn-from-pr-issue.md)
- [`LazyLock` 未稳定的难点](./learn-from-pr-issue/LazyLock.md)
79 changes: 79 additions & 0 deletions src/forum/lib.rs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# [lib.rs] 网站新功能一览

> src: 2023.08.17 [New features on lib.rs](https://users.rust-lang.org/t/new-features-on-lib-rs/98560)
[lib.rs]: https://lib.rs/

![](./librs/new.png)

# 1. 新的 feature 页面

通过解析以下内容
1. `Cargo.toml` 中 feature 名上方的注释(以 markdown 方式)
2. 源代码中 `cfg(feature = "…")` 的 API (以短路径方式)

罗列、展示并分类 features。例如对于以下内容

```toml
[features]
default = ["std"]

# Provide derive(Serialize, Deserialize) macros.

derive = ["serde_derive"]

# Provide impls for common standard library types like Vec<T> and HashMap<K, V>.
# Requires a dependency on the Rust standard library.
std = []

# Provide impls for types that require unstable functionality. For tracking and
# discussion of unstable functionality please refer to this issue:
#
# https://github.com/serde-rs/serde/issues/812
unstable = []
```

```rust
#[cfg(feature = "unstable")]
pub struct NeverDeserializer<E> {
never: !,
marker: PhantomData<E>,
}
```

得到的 feature 页面

![](./librs/features-page.png)

一些实际例子:
* <https://lib.rs/crates/serde/features>
* <https://lib.rs/crates/quick-xml/features>
* <https://lib.rs/crates/serde_with/features>

# 2. 新的审计页面

该页面集成以下审计来源:
* 【新增】[cargo-vet](https://github.com/mozilla/cargo-vet):来自 Google、Mozilla、未修复的 rustsec 公告
* [cargo-crev](https://github.com/crev-dev/cargo-crev):与语言和生态系统无关的分布式、加密验证的代码审查系统

![](./librs/audit.png)

例如:
* <https://lib.rs/crates/serde/audit>
* <https://lib.rs/crates/failure/audit>

# 3. 精简反向依赖图

对于很多版本的库,对下载量少的版本进行合并,避免图形很长。

![](./librs/reverse-dep.png)

# 其他更新

* 新的维护状态标签
* 部分修复 github 账号重命名之后的仓库链接失效问题
* 更准确的仓库链接
* markdown 渲染问题:修复 ``[`crate::ident`]`` 、自动检测
* 添加改进的关键字:猜测类别
* 处理同一依赖的多版本问题(使用了 package 别名)
* 更新 [免责声明](https://lib.rs/data-processing)
Binary file added src/forum/librs/audit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/forum/librs/features-page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/forum/librs/new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/forum/librs/reverse-dep.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 584c70b

Please sign in to comment.