Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
.github/ | 12-May-2024 | - | 594 | 495 | ||
ci/ | 12-May-2024 | - | 3,096 | 2,381 | ||
libc-test/ | 12-May-2024 | - | 25,721 | 24,380 | ||
src/ | 12-May-2024 | - | 103,786 | 92,952 | ||
tests/ | 12-May-2024 | - | 6 | 3 | ||
.cirrus.yml | D | 12-May-2024 | 1.3 KiB | 42 | 39 | |
.gitignore | D | 12-May-2024 | 27 | 5 | 4 | |
BUILD.gn | D | 12-May-2024 | 1 KiB | 35 | 31 | |
CONTRIBUTING.md | D | 12-May-2024 | 4.3 KiB | 94 | 71 | |
Cargo.toml | D | 12-May-2024 | 954 | 36 | 31 | |
LICENSE-APACHE | D | 12-May-2024 | 9.5 KiB | 177 | 150 | |
LICENSE-MIT | D | 12-May-2024 | 1.1 KiB | 26 | 22 | |
OAT.xml | D | 12-May-2024 | 4.1 KiB | 67 | 12 | |
README zh.md | D | 12-May-2024 | 3.6 KiB | 103 | 75 | |
README.OpenSource | D | 12-May-2024 | 339 | 11 | 11 | |
README.md | D | 12-May-2024 | 4.1 KiB | 111 | 78 | |
build.rs | D | 12-May-2024 | 5.9 KiB | 179 | 126 | |
rustfmt.toml | D | 12-May-2024 | 30 | 2 | 1 | |
triagebot.toml | D | 12-May-2024 | 589 | 26 | 19 |
README zh.md
1# libc - 提供 C 标准库的rust侧FFI 2 3[![GHA Status]][GitHub Actions] [![Cirrus CI Status]][Cirrus CI] [![Latest Version]][crates.io] [![Documentation]][docs.rs] ![License] 4 5## 引入背景 6`libc`提供了所有必要的定义,以便在Rust轻松与C 7代码(或 "类C "代码)在Rust支持的平台上的调用。这包括 8包括类型定义(如`c_int`),常量(如`EINVAL`)以及 9函数(例如:`malloc')。 10 11libc将各类平台中C库的类型、函数和常量导出在根目录下,所以所有项目都可以作为`libc::foo'访问这些API。 12所有导出的API的类型和值都与 libc 编译的平台一致。 13 14关于这个库的设计,更详细的信息可以在这里找到 15[associated RFC][rfc]. 16 17[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1291-promote-libc.md 18 19## 用法指导 20### 使用Openharmony编译框架 21在你的"BUILD.gn"中使用deps字段添加对libc crate的依赖,例如: 22 23```BUILD.gn 24ohos_rust_shared_library("foo") { 25 source = [ "src/lib.rs" ] 26 deps = [ "//third_party/rust/crates/libc:lib" ] 27} 28``` 29 30### 使用Cargo 31在你的 "Cargo.toml "中添加以下内容: 32 33```toml 34[dependencies] 35libc = "0.2" 36``` 37 38## 特点 39 40* `std`:默认情况下,`libc`链接到标准库。禁用这个 41 来消除这一依赖关系,并能够在`#![no_std]`中使用`libc`。 42 crates。 43 44* `extra_traits`: `libc`中实现的所有`结构'都是`Copy`和`Clone`。 45 这个特性衍生出了`Debug`、`Eq`、`Hash`和`PartialEq`。 46 47* `const-extern-fn`: 将一些`extern fn`s改为`const extern fn`s。 48 如果你使用Rust >= 1.62,这个功能是隐式启用的。 49 否则,它需要一个夜间的Rustc。 50 51**已废弃**: `use_std`已被废弃,等同于`std`。 52 53## Rust版本支持 54 55目前支持的最小Rust工具链版本是**Rust 1.13.0**。(libc 目前没有任何计划关于改变最小支持的支持的 Rust 版本)。需要较新的 Rust 特性的 API 只在较新的 Rust 工具链上可用: 56 57| Feature | Version | 58|----------------------|---------| 59| `union` | 1.19.0 | 60| `const mem::size_of` | 1.24.0 | 61| `repr(align)` | 1.25.0 | 62| `extra_traits` | 1.25.0 | 63| `core::ffi::c_void` | 1.30.0 | 64| `repr(packed(N))` | 1.33.0 | 65| `cfg(target_vendor)` | 1.33.0 | 66| `const-extern-fn` | 1.62.0 | 67 68## 平台支持 69 70[特定平台文档(master分支)][docs.master]。 71 72见[`ci/build.sh`](https://github.com/rust-lang/libc/blob/master/ci/build.sh) 73关于每个Rust工具链的`libc`保证可以在哪些平台上构建。 74工具链的平台。在[GitHub Actions]和[Cirrus CI]中的测试矩阵显示了 75`libc`测试运行的平台。 76<div class="platform_docs"></div> 77 78## 许可证 79 80本项目的授权范围是 81 82* [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0) 83 ([LICENSE-APACHE](https://github.com/rust-lang/libc/blob/master/LICENSE-APACHE)) 84 85* [MIT License](https://opensource.org/licenses/MIT) 86 ([LICENSE-MIT](https://github.com/rust-lang/libc/blob/master/LICENSE-MIT)) 87 88[GitHub Actions]: https://github.com/rust-lang/libc/actions 89[GHA Status]: https://github.com/rust-lang/libc/workflows/CI/badge.svg 90[Cirrus CI]: https://cirrus-ci.com/github/rust-lang/libc 91[Cirrus CI Status]: https://api.cirrus-ci.com/github/rust-lang/libc.svg 92[crates.io]: https://crates.io/crates/libc 93[Latest Version]: https://img.shields.io/crates/v/libc.svg 94[Documentation]: https://docs.rs/libc/badge.svg 95[docs.rs]: https://docs.rs/libc 96[License]: https://img.shields.io/crates/l/libc.svg 97[docs.master]: https://rust-lang.github.io/libc/#platform-specific-documentation 98 99## 开发者贡献 100 101在使用该工具的过程中有任何问题欢迎开发者在社区issue中反馈。 102 103<br>
README.OpenSource
1[ 2 { 3 "Name": "libc", 4 "License": "Apache License V2.0, MIT", 5 "License File": "LICENSE-APACHE, LICENSE-MIT", 6 "Version Number": "0.2.139", 7 "Owner": "fangting12@huawei.com", 8 "Upstream URL": "https://github.com/rust-lang/libc", 9 "Description": "A Rust library that provides bindings to the C standard library." 10 } 11]
README.md
1# libc - Raw FFI bindings to platforms' system libraries 2 3[![GHA Status]][GitHub Actions] [![Cirrus CI Status]][Cirrus CI] [![Latest Version]][crates.io] [![Documentation]][docs.rs] ![License] 4 5`libc` provides all of the definitions necessary to easily interoperate with C 6code (or "C-like" code) on each of the platforms that Rust supports. This 7includes type definitions (e.g. `c_int`), constants (e.g. `EINVAL`) as well as 8function headers (e.g. `malloc`). 9 10This crate exports all underlying platform types, functions, and constants under 11the crate root, so all items are accessible as `libc::foo`. The types and values 12of all the exported APIs match the platform that libc is compiled for. 13 14More detailed information about the design of this library can be found in its 15[associated RFC][rfc]. 16 17[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1291-promote-libc.md 18 19## Usage 20 21Add the following to your `Cargo.toml`: 22 23```toml 24[dependencies] 25libc = "0.2" 26``` 27 28## Features 29 30* `std`: by default `libc` links to the standard library. Disable this 31 feature to remove this dependency and be able to use `libc` in `#![no_std]` 32 crates. 33 34* `extra_traits`: all `struct`s implemented in `libc` are `Copy` and `Clone`. 35 This feature derives `Debug`, `Eq`, `Hash`, and `PartialEq`. 36 37* `const-extern-fn`: Changes some `extern fn`s into `const extern fn`s. 38 If you use Rust >= 1.62, this feature is implicitly enabled. 39 Otherwise it requires a nightly rustc. 40 41* **deprecated**: `use_std` is deprecated, and is equivalent to `std`. 42 43## Rust version support 44 45The minimum supported Rust toolchain version is currently **Rust 1.13.0**. 46(libc does not currently have any policy regarding changes to the minimum 47supported Rust version; such policy is a work in progress.) APIs requiring 48newer Rust features are only available on newer Rust toolchains: 49 50| Feature | Version | 51|----------------------|---------| 52| `union` | 1.19.0 | 53| `const mem::size_of` | 1.24.0 | 54| `repr(align)` | 1.25.0 | 55| `extra_traits` | 1.25.0 | 56| `core::ffi::c_void` | 1.30.0 | 57| `repr(packed(N))` | 1.33.0 | 58| `cfg(target_vendor)` | 1.33.0 | 59| `const-extern-fn` | 1.62.0 | 60 61## Platform support 62 63[Platform-specific documentation (master branch)][docs.master]. 64 65See 66[`ci/build.sh`](https://github.com/rust-lang/libc/blob/master/ci/build.sh) 67for the platforms on which `libc` is guaranteed to build for each Rust 68toolchain. The test-matrix at [GitHub Actions] and [Cirrus CI] show the 69platforms in which `libc` tests are run. 70 71<div class="platform_docs"></div> 72 73## License 74 75This project is licensed under either of 76 77* [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0) 78 ([LICENSE-APACHE](https://github.com/rust-lang/libc/blob/master/LICENSE-APACHE)) 79 80* [MIT License](https://opensource.org/licenses/MIT) 81 ([LICENSE-MIT](https://github.com/rust-lang/libc/blob/master/LICENSE-MIT)) 82 83at your option. 84 85## Contributing 86 87We welcome all people who want to contribute. Please see the [contributing 88instructions] for more information. 89 90[contributing instructions]: https://github.com/rust-lang/libc/blob/master/CONTRIBUTING.md 91 92Contributions in any form (issues, pull requests, etc.) to this project 93must adhere to Rust's [Code of Conduct]. 94 95[Code of Conduct]: https://www.rust-lang.org/policies/code-of-conduct 96 97Unless you explicitly state otherwise, any contribution intentionally submitted 98for inclusion in `libc` by you, as defined in the Apache-2.0 license, shall be 99dual licensed as above, without any additional terms or conditions. 100 101[GitHub Actions]: https://github.com/rust-lang/libc/actions 102[GHA Status]: https://github.com/rust-lang/libc/workflows/CI/badge.svg 103[Cirrus CI]: https://cirrus-ci.com/github/rust-lang/libc 104[Cirrus CI Status]: https://api.cirrus-ci.com/github/rust-lang/libc.svg 105[crates.io]: https://crates.io/crates/libc 106[Latest Version]: https://img.shields.io/crates/v/libc.svg 107[Documentation]: https://docs.rs/libc/badge.svg 108[docs.rs]: https://docs.rs/libc 109[License]: https://img.shields.io/crates/l/libc.svg 110[docs.master]: https://rust-lang.github.io/libc/#platform-specific-documentation 111