rust_demo_lib 0.1.0

一个用于演示如何编写和发布 Rust 库的示例库
Documentation
  • Coverage
  • 100%
    8 out of 8 items documented5 out of 6 items with examples
  • Size
  • Source code size: 4.42 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.3 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 38s Average build duration of successful builds.
  • all releases: 38s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jiuyue1123

rust_demo_lib

一个用于演示如何编写和发布 Rust 库的示例库。

安装

Cargo.toml 中添加:

[dependencies]

rust_demo_lib = "0.1.0"

使用示例

use rust_demo_lib::{add, is_even, Point};

// 整数相加
println!("{}", add(2, 3)); // 5

// 判断奇偶
println!("{}", is_even(4)); // true

// 二维点
let p = Point::new(3.0, 4.0);
println!("{}", p.distance_from_origin()); // 5.0

文档

完整 API 文档见 docs.rs/rust_demo_lib

License

MIT