mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-05-14 06:36:33 +02:00
chromium part 4/5 (#2360)
chromium part 4/5 --------- Co-authored-by: javad-jafari <javajafarifromsharak@gmail.com> Co-authored-by: javad-jafari <65780584+javad-jafari@users.noreply.github.com>
This commit is contained in:
parent
d0a93291b6
commit
1afd366024
379
po/fa.po
379
po/fa.po
@ -16216,385 +16216,6 @@ msgstr ""
|
|||||||
"cxx.h\"` را وارد کنید."
|
"cxx.h\"` را وارد کنید."
|
||||||
|
|
||||||
#: src/exercises/chromium/interoperability-with-cpp.md:29
|
#: src/exercises/chromium/interoperability-with-cpp.md:29
|
||||||
msgid "Pass a C++ string from C++ into Rust."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/exercises/chromium/interoperability-with-cpp.md:30
|
|
||||||
msgid "Pass a reference to a C++ object into Rust."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/exercises/chromium/interoperability-with-cpp.md:31
|
|
||||||
msgid ""
|
|
||||||
"Intentionally get the Rust function signatures mismatched from the `#[cxx::"
|
|
||||||
"bridge]`, and get used to the errors you see."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/exercises/chromium/interoperability-with-cpp.md:33
|
|
||||||
msgid ""
|
|
||||||
"Intentionally get the C++ function signatures mismatched from the `#[cxx::"
|
|
||||||
"bridge]`, and get used to the errors you see."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/exercises/chromium/interoperability-with-cpp.md:35
|
|
||||||
msgid ""
|
|
||||||
"Pass a `std::unique_ptr` of some type from C++ into Rust, so that Rust can "
|
|
||||||
"own some C++ object."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/exercises/chromium/interoperability-with-cpp.md:37
|
|
||||||
msgid ""
|
|
||||||
"Create a Rust object and pass it into C++, so that C++ owns it. (Hint: you "
|
|
||||||
"need a `Box`)."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/exercises/chromium/interoperability-with-cpp.md:39
|
|
||||||
msgid "Declare some methods on a C++ type. Call them from Rust."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/exercises/chromium/interoperability-with-cpp.md:40
|
|
||||||
msgid "Declare some methods on a Rust type. Call them from C++."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/exercises/chromium/interoperability-with-cpp.md:42
|
|
||||||
msgid "Part three"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/exercises/chromium/interoperability-with-cpp.md:44
|
|
||||||
msgid ""
|
|
||||||
"Now you understand the strengths and limitations of CXX interop, think of a "
|
|
||||||
"couple of use-cases for Rust in Chromium where the interface would be "
|
|
||||||
"sufficiently simple. Sketch how you might define that interface."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/exercises/chromium/interoperability-with-cpp.md:50
|
|
||||||
msgid "The [`cxx` binding reference](https://cxx.rs/bindings.html)"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/exercises/chromium/interoperability-with-cpp.md:51
|
|
||||||
msgid ""
|
|
||||||
"The [`rust_static_library` gn template](https://source.chromium.org/chromium/"
|
|
||||||
"chromium/src/+/main:build/rust/rust_static_library.gni;l=16)"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/exercises/chromium/interoperability-with-cpp.md:57
|
|
||||||
msgid "Some of the questions you may encounter:"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/exercises/chromium/interoperability-with-cpp.md:59
|
|
||||||
msgid ""
|
|
||||||
"I'm seeing a problem initializing a variable of type X with type Y, where X "
|
|
||||||
"and Y are both function types. This is because your C++ function doesn't "
|
|
||||||
"quite match the declaration in your `cxx::bridge`."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/exercises/chromium/interoperability-with-cpp.md:62
|
|
||||||
msgid ""
|
|
||||||
"I seem to be able to freely convert C++ references into Rust references. "
|
|
||||||
"Doesn't that risk UB? For CXX's _opaque_ types, no, because they are zero-"
|
|
||||||
"sized. For CXX trivial types yes, it's _possible_ to cause UB, although "
|
|
||||||
"CXX's design makes it quite difficult to craft such an example."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates.md
|
|
||||||
msgid ""
|
|
||||||
"Rust libraries are called \"crates\" and are found at [crates.io](https://"
|
|
||||||
"crates.io). It's _very easy_ for Rust crates to depend upon one another. So "
|
|
||||||
"they do!"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates.md
|
|
||||||
msgid "Property"
|
|
||||||
msgstr "ویژگی"
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates.md
|
|
||||||
#, fuzzy
|
|
||||||
msgid "C++ library"
|
|
||||||
msgstr "کتابخانه"
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates.md
|
|
||||||
#, fuzzy
|
|
||||||
msgid "Rust crate"
|
|
||||||
msgstr "اکوسیستم Rust"
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates.md
|
|
||||||
#, fuzzy
|
|
||||||
msgid "Build system"
|
|
||||||
msgstr "اکوسیستم Rust"
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates.md
|
|
||||||
msgid "Lots"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates.md
|
|
||||||
msgid "Consistent: `Cargo.toml`"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates.md
|
|
||||||
msgid "Typical library size"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates.md
|
|
||||||
msgid "Large-ish"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates.md
|
|
||||||
msgid "Small"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates.md
|
|
||||||
msgid "Transitive dependencies"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates.md
|
|
||||||
msgid "Few"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates.md
|
|
||||||
msgid "For a Chromium engineer, this has pros and cons:"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates.md
|
|
||||||
msgid ""
|
|
||||||
"All crates use a common build system so we can automate their inclusion into "
|
|
||||||
"Chromium..."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates.md
|
|
||||||
msgid ""
|
|
||||||
"... but, crates typically have transitive dependencies, so you will likely "
|
|
||||||
"have to bring in multiple libraries."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates.md
|
|
||||||
msgid "We'll discuss:"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates.md
|
|
||||||
msgid "How to put a crate in the Chromium source code tree"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates.md
|
|
||||||
msgid "How to make `gn` build rules for it"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates.md
|
|
||||||
msgid "How to audit its source code for sufficient safety."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/configuring-cargo-toml.md:1
|
|
||||||
msgid "Configuring the `Cargo.toml` file to add crates"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/configuring-cargo-toml.md:3
|
|
||||||
msgid ""
|
|
||||||
"Chromium has a single set of centrally-managed direct crate dependencies. "
|
|
||||||
"These are managed through a single [`Cargo.toml`](https://source.chromium."
|
|
||||||
"org/chromium/chromium/src/+/main:third_party/rust/chromium_crates_io/Cargo."
|
|
||||||
"toml):"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/configuring-cargo-toml.md:6
|
|
||||||
msgid ""
|
|
||||||
"```toml\n"
|
|
||||||
"[dependencies]\n"
|
|
||||||
"bitflags = \"1\"\n"
|
|
||||||
"cfg-if = \"1\"\n"
|
|
||||||
"cxx = \"1\"\n"
|
|
||||||
"# lots more...\n"
|
|
||||||
"```"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/configuring-cargo-toml.md:14
|
|
||||||
msgid ""
|
|
||||||
"As with any other `Cargo.toml`, you can specify [more details about the "
|
|
||||||
"dependencies](https://doc.rust-lang.org/cargo/reference/specifying-"
|
|
||||||
"dependencies.html) --- most commonly, you'll want to specify the `features` "
|
|
||||||
"that you wish to enable in the crate."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/configuring-cargo-toml.md:18
|
|
||||||
msgid ""
|
|
||||||
"When adding a crate to Chromium, you'll often need to provide some extra "
|
|
||||||
"information in an additional file, `gnrt_config.toml`, which we'll meet next."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/configuring-gnrt-config-toml.md:3
|
|
||||||
msgid ""
|
|
||||||
"Alongside `Cargo.toml` is [`gnrt_config.toml`](https://source.chromium.org/"
|
|
||||||
"chromium/chromium/src/+/main:third_party/rust/chromium_crates_io/gnrt_config."
|
|
||||||
"toml). This contains Chromium-specific extensions to crate handling."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/configuring-gnrt-config-toml.md:6
|
|
||||||
msgid ""
|
|
||||||
"If you add a new crate, you should specify at least the `group`. This is one "
|
|
||||||
"of:"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/configuring-gnrt-config-toml.md:15
|
|
||||||
#: src/chromium/adding-third-party-crates/depending-on-a-crate.md:15
|
|
||||||
msgid "For instance,"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/configuring-gnrt-config-toml.md:22
|
|
||||||
msgid ""
|
|
||||||
"Depending on the crate source code layout, you may also need to use this "
|
|
||||||
"file to specify where its `LICENSE` file(s) can be found."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/configuring-gnrt-config-toml.md:25
|
|
||||||
msgid ""
|
|
||||||
"Later, we'll see some other things you will need to configure in this file "
|
|
||||||
"to resolve problems."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/downloading-crates.md:3
|
|
||||||
msgid ""
|
|
||||||
"A tool called `gnrt` knows how to download crates and how to generate `BUILD."
|
|
||||||
"gn` rules."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/downloading-crates.md:6
|
|
||||||
msgid "To start, download the crate you want like this:"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/downloading-crates.md:13
|
|
||||||
msgid ""
|
|
||||||
"Although the `gnrt` tool is part of the Chromium source code, by running "
|
|
||||||
"this command you will be downloading and running its dependencies from "
|
|
||||||
"`crates.io`. See [the earlier section](../cargo.md) discussing this security "
|
|
||||||
"decision."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/downloading-crates.md:17
|
|
||||||
msgid "This `vendor` command may download:"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/downloading-crates.md:19
|
|
||||||
#, fuzzy
|
|
||||||
msgid "Your crate"
|
|
||||||
msgstr "جعبههای (crates) کاربردی"
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/downloading-crates.md:20
|
|
||||||
msgid "Direct and transitive dependencies"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/downloading-crates.md:21
|
|
||||||
msgid ""
|
|
||||||
"New versions of other crates, as required by `cargo` to resolve the complete "
|
|
||||||
"set of crates required by Chromium."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/downloading-crates.md:24
|
|
||||||
msgid ""
|
|
||||||
"Chromium maintains patches for some crates, kept in `//third_party/rust/"
|
|
||||||
"chromium_crates_io/patches`. These will be reapplied automatically, but if "
|
|
||||||
"patching fails you may need to take manual action."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/generating-gn-build-rules.md:3
|
|
||||||
msgid ""
|
|
||||||
"Once you've downloaded the crate, generate the `BUILD.gn` files like this:"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/generating-gn-build-rules.md:9
|
|
||||||
msgid "Now run `git status`. You should find:"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/generating-gn-build-rules.md:11
|
|
||||||
msgid ""
|
|
||||||
"At least one new crate source code in `third_party/rust/chromium_crates_io/"
|
|
||||||
"vendor`"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/generating-gn-build-rules.md:13
|
|
||||||
msgid ""
|
|
||||||
"At least one new `BUILD.gn` in `third_party/rust/<crate name>/v<major semver "
|
|
||||||
"version>`"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/generating-gn-build-rules.md:15
|
|
||||||
msgid "An appropriate `README.chromium`"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/generating-gn-build-rules.md:17
|
|
||||||
#, fuzzy
|
|
||||||
msgid ""
|
|
||||||
"The \"major semver version\" is a [Rust \"semver\" version number](https://"
|
|
||||||
"doc.rust-lang.org/cargo/reference/semver.html)."
|
|
||||||
msgstr ""
|
|
||||||
"لطفا به [مرجع Rust ](https://doc.rust-lang.org/reference/type-layout.html) "
|
|
||||||
"مراجعه کنید."
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/generating-gn-build-rules.md:19
|
|
||||||
msgid ""
|
|
||||||
"Take a close look, especially at the things generated in `third_party/rust`."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/generating-gn-build-rules.md:23
|
|
||||||
msgid ""
|
|
||||||
"Talk a little about semver --- and specifically the way that in Chromium "
|
|
||||||
"it's to allow multiple incompatible versions of a crate, which is "
|
|
||||||
"discouraged but sometimes necessary in the Cargo ecosystem."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/resolving-problems.md:3
|
|
||||||
msgid ""
|
|
||||||
"If your build fails, it may be because of a `build.rs`: programs which do "
|
|
||||||
"arbitrary things at build time. This is fundamentally at odds with the "
|
|
||||||
"design of `gn` and `ninja` which aim for static, deterministic, build rules "
|
|
||||||
"to maximize parallelism and repeatability of builds."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/resolving-problems.md:8
|
|
||||||
msgid ""
|
|
||||||
"Some `build.rs` actions are automatically supported; others require action:"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/resolving-problems.md:10
|
|
||||||
msgid "build script effect"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/resolving-problems.md:10
|
|
||||||
msgid "Supported by our gn templates"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/resolving-problems.md:10
|
|
||||||
msgid "Work required by you"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/resolving-problems.md:12
|
|
||||||
msgid "Checking rustc version to configure features on and off"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/resolving-problems.md:12
|
|
||||||
#: src/chromium/adding-third-party-crates/resolving-problems.md:13
|
|
||||||
#: src/chromium/adding-third-party-crates/resolving-problems.md:14
|
|
||||||
msgid "Yes"
|
|
||||||
msgstr "بلی"
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/resolving-problems.md:12
|
|
||||||
#: src/chromium/adding-third-party-crates/resolving-problems.md:13
|
|
||||||
msgid "None"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/resolving-problems.md:13
|
|
||||||
msgid "Checking platform or CPU to configure features on and off"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/resolving-problems.md:14
|
|
||||||
#, fuzzy
|
|
||||||
msgid "Generating code"
|
|
||||||
msgstr "جنریکها"
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/resolving-problems.md:14
|
|
||||||
msgid "Yes - specify in `gnrt_config.toml`"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/resolving-problems.md:15
|
|
||||||
msgid "Building C/C++"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/chromium/adding-third-party-crates/resolving-problems.md:15
|
#: src/chromium/adding-third-party-crates/resolving-problems.md:15
|
||||||
#: src/chromium/adding-third-party-crates/resolving-problems.md:16
|
#: src/chromium/adding-third-party-crates/resolving-problems.md:16
|
||||||
msgid "No"
|
msgid "No"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user