[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-5463":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":13,"stars90d":15,"forks30d":15,"starsTrendScore":18,"compositeScore":19,"rankGlobal":9,"rankLanguage":9,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":9,"pushedAt":9,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":15,"starSnapshotCount":15,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},5463,"rayon","rayon-rs\u002Frayon","rayon-rs","Rayon: A data parallelism library for Rust",null,"Rust",13058,589,103,194,0,3,23,14,95.81,"Apache License 2.0",false,"main",true,[],"2026-06-12 04:00:25","# Rayon\n\n[![Rayon crate](https:\u002F\u002Fimg.shields.io\u002Fcrates\u002Fv\u002Frayon.svg)](https:\u002F\u002Fcrates.io\u002Fcrates\u002Frayon)\n[![Rayon documentation](https:\u002F\u002Fdocs.rs\u002Frayon\u002Fbadge.svg)](https:\u002F\u002Fdocs.rs\u002Frayon)\n![minimum rustc 1.85](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Frustc-1.85+-red.svg)\n[![build status](https:\u002F\u002Fgithub.com\u002Frayon-rs\u002Frayon\u002Fworkflows\u002Fmain\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Frayon-rs\u002Frayon\u002Factions)\n\nRayon is a data-parallelism library for Rust. It is extremely\nlightweight and makes it easy to convert a sequential computation into\na parallel one. It also guarantees data-race freedom. (You may also\nenjoy [this blog post][blog] about Rayon, which gives more background\nand details about how it works, or [this video][video], from the Rust\nBelt Rust conference.) Rayon is\n[available on crates.io](https:\u002F\u002Fcrates.io\u002Fcrates\u002Frayon), and\n[API documentation is available on docs.rs](https:\u002F\u002Fdocs.rs\u002Frayon).\n\n[blog]: https:\u002F\u002Fsmallcultfollowing.com\u002Fbabysteps\u002Fblog\u002F2015\u002F12\u002F18\u002Frayon-data-parallelism-in-rust\u002F\n[video]: https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=gof_OEv71Aw\n\n## Parallel iterators and more\n\nRayon makes it drop-dead simple to convert sequential iterators into\nparallel ones: usually, you just change your `foo.iter()` call into\n`foo.par_iter()`, and Rayon does the rest:\n\n```rust\nuse rayon::prelude::*;\nfn sum_of_squares(input: &[i32]) -> i32 {\n    input.par_iter() \u002F\u002F \u003C-- just change that!\n         .map(|&i| i * i)\n         .sum()\n}\n```\n\n[Parallel iterators] take care of deciding how to divide your data\ninto tasks; it will dynamically adapt for maximum performance. If you\nneed more flexibility than that, Rayon also offers the [join] and\n[scope] functions, which let you create parallel tasks on your own.\nFor even more control, you can create [custom thread pools] rather than\nusing Rayon's default, global thread pool.\n\n[Parallel iterators]: https:\u002F\u002Fdocs.rs\u002Frayon\u002F*\u002Frayon\u002Fiter\u002Findex.html\n[join]: https:\u002F\u002Fdocs.rs\u002Frayon\u002F*\u002Frayon\u002Ffn.join.html\n[scope]: https:\u002F\u002Fdocs.rs\u002Frayon\u002F*\u002Frayon\u002Ffn.scope.html\n[custom thread pools]: https:\u002F\u002Fdocs.rs\u002Frayon\u002F*\u002Frayon\u002Fstruct.ThreadPool.html\n\n## No data races\n\nYou may have heard that parallel execution can produce all kinds of\ncrazy bugs. Well, rest easy. Rayon's APIs all guarantee **data-race\nfreedom**, which generally rules out most parallel bugs (though not\nall). In other words, **if your code compiles**, it typically does the\nsame thing it did before.\n\nFor the most part, parallel iterators in particular are guaranteed to\nproduce the same results as their sequential counterparts. One caveat:\nIf your iterator has side effects (for example, sending methods to\nother threads through a [Rust channel] or writing to disk), those side\neffects may occur in a different order. Note also that, in some cases,\nparallel iterators offer alternative versions of the sequential\niterator methods that can have higher performance.\n\n[Rust channel]: https:\u002F\u002Fdoc.rust-lang.org\u002Fstd\u002Fsync\u002Fmpsc\u002Ffn.channel.html\n\n## Using Rayon\n\n[Rayon is available on crates.io](https:\u002F\u002Fcrates.io\u002Fcrates\u002Frayon). The\nrecommended way to use it is to add a line into your Cargo.toml such\nas:\n\n```toml\n[dependencies]\nrayon = \"1.12\"\n```\n\nTo use the parallel iterator APIs, a number of traits have to be in\nscope. The easiest way to bring those things into scope is to use the\n[Rayon prelude](https:\u002F\u002Fdocs.rs\u002Frayon\u002F*\u002Frayon\u002Fprelude\u002Findex.html). In\neach module where you would like to use the parallel iterator APIs,\njust add:\n\n```rust\nuse rayon::prelude::*;\n```\n\nRayon currently requires `rustc 1.85.0` or greater.\n\n### Usage with WebAssembly\n\nBy default, when building to WebAssembly, Rayon will treat it as any\nother platform without multithreading support and will fall back to\nsequential iteration. This allows existing code to compile and run\nsuccessfully with no changes necessary, but it will run slower as it\nwill only use a single CPU core.\n\nYou can build Rayon-based projects with proper multithreading support\nfor the Web, but you'll need an adapter and some project configuration\nto account for differences between WebAssembly threads and threads on\nthe other platforms.\n\nCheck out the\n[wasm-bindgen-rayon](https:\u002F\u002Fgithub.com\u002FRReverser\u002Fwasm-bindgen-rayon)\ndocs for more details.\n\n## Contribution\n\nRayon is an open source project! If you'd like to contribute to Rayon,\ncheck out\n[the list of \"help wanted\" issues](https:\u002F\u002Fgithub.com\u002Frayon-rs\u002Frayon\u002Fissues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22).\nThese are all (or should be) issues that are suitable for getting\nstarted, and they generally include a detailed set of instructions for\nwhat to do. Please ask questions if anything is unclear! Also, check\nout the\n[Guide to Development](https:\u002F\u002Fgithub.com\u002Frayon-rs\u002Frayon\u002Fwiki\u002FGuide-to-Development)\npage on the wiki. Note that all code submitted in PRs to Rayon is\nassumed to\n[be licensed under Rayon's dual MIT\u002FApache 2.0 licensing](https:\u002F\u002Fgithub.com\u002Frayon-rs\u002Frayon\u002Fblob\u002Fmain\u002FREADME.md#license).\n\n## Quick demo\n\nTo see Rayon in action, check out the `rayon-demo` directory, which\nincludes a number of demos of code using Rayon. For example, run this\ncommand to get a visualization of an N-body simulation. To see the\neffect of using Rayon, press `s` to run sequentially and `p` to run in\nparallel.\n\n```text\n> cd rayon-demo\n> cargo run --release -- nbody visualize\n```\n\nFor more information on demos, try:\n\n```text\n> cd rayon-demo\n> cargo run --release -- --help\n```\n\n## Other questions?\n\nSee [the Rayon FAQ][faq].\n\n[faq]: https:\u002F\u002Fgithub.com\u002Frayon-rs\u002Frayon\u002Fblob\u002Fmain\u002FFAQ.md\n\n## License\n\nRayon is distributed under the terms of both the MIT license and the\nApache License (Version 2.0). See [LICENSE-APACHE](LICENSE-APACHE) and\n[LICENSE-MIT](LICENSE-MIT) for details. Opening a pull request is\nassumed to signal agreement with these licensing terms.\n","Rayon 是一个用于 Rust 语言的数据并行计算库。它极其轻量级，能够轻易地将顺序计算转换为并行计算，并且确保了无数据竞争的安全性。核心功能包括通过简单修改迭代器调用（如从 `foo.iter()` 改为 `foo.par_iter()`）来实现并行处理，同时提供了 join 和 scope 等高级控制函数以及自定义线程池的支持，以满足更复杂的并行需求。适用于需要提高数据处理效率的场景，特别是在大数据集上的操作，能够显著提升程序性能而不牺牲代码的正确性和可读性。",2,"2026-06-11 03:03:29","top_language"]