From dd239e648f3e821531a43633e3de9d531831eb49 Mon Sep 17 00:00:00 2001 From: Marcus Stollsteimer Date: Wed, 29 May 2024 17:12:57 +0200 Subject: [PATCH] Fix some typos in the book (#375) --- book/src/SUMMARY.md | 3 ++- book/src/background-and-concepts.md | 8 ++++---- book/src/getting-started.md | 4 ++-- book/src/tutorial/publishing/cross-compilation.md | 12 ++++++------ 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/book/src/SUMMARY.md b/book/src/SUMMARY.md index dd47c183..9d8d81c6 100644 --- a/book/src/SUMMARY.md +++ b/book/src/SUMMARY.md @@ -1,6 +1,7 @@ # Summary -[Introduction](./introduction.md) [Getting Started](./getting-started.md) +[Introduction](./introduction.md) +[Getting Started](./getting-started.md) [Background and Concepts](./background-and-concepts.md) --- diff --git a/book/src/background-and-concepts.md b/book/src/background-and-concepts.md index 0374666d..0557bb70 100644 --- a/book/src/background-and-concepts.md +++ b/book/src/background-and-concepts.md @@ -3,7 +3,7 @@ ## World's Simplest Rust Extension To illustrate how native extensions work, we are going to create the simplest possible native extension for Ruby. This -is only to shows the core concepts of how native extensions work under the hood. +is only to show the core concepts of how native extensions work under the hood. ```rust // simplest_rust_extenion.rs @@ -25,7 +25,7 @@ unsafe extern "C" fn Init_simplest_rust_extension() { } ``` -Then, its a matter of compiling and running like so: +Then, it's a matter of compiling and running like so: ```sh $ rustc --crate-type=cdylib simplest_rust_extension.rs -o simplest_rust_extension.bundle -C link-arg="-Wl,-undefined,dynamic_lookup" @@ -49,7 +49,7 @@ $ ruby --dump=insns -e '2 + 3' In this example, `2` and `3` are pushed onto the stack, and then `opt_plus` performs the addition. -For a native gem, we bypass this mechanism entirely and instead exposes native machine code to Ruby. In our native code, +For a native gem, we bypass this mechanism entirely and instead expose native machine code to Ruby. In our native code, we can use the [Ruby C API] to interact with the Ruby VM. ## How are native Gems loaded? @@ -62,7 +62,7 @@ the system equivalent). After that, Ruby will call `Init_some_gem` so the native C is often referred to as the "lingua franca" of the programming language world, and Rust is fluent. Rust can compile functions to be compatible with the C calling conventions, and align items in memory in a way that C understands. Rust -also does not have a garbage collector, which makes integration signifcantly easier. +also does not have a garbage collector, which makes integration significantly easier. When Ruby loads a gem extension written in Rust, it has no idea the gem is actually written in Rust. Due to Rust's robust C FFI, you can code anything in Rust that you could with C. diff --git a/book/src/getting-started.md b/book/src/getting-started.md index 82c414cf..23f9962a 100644 --- a/book/src/getting-started.md +++ b/book/src/getting-started.md @@ -24,7 +24,7 @@ and `magnus`. ``` This will create a new gem in the `my_gem_name` directory. Firstly, open up `my_gem_name.gemspec` in your text editor -and make sure you update all fields that contain `TODO`. Inside the directly, you should now have a fully working Rust +and make sure you update all fields that contain `TODO`. Inside the directory, you should now have a fully working Rust gem. > **💡 Tip:** [Join the Slack channel][slack] to ask questions and get help from the community! @@ -37,7 +37,7 @@ The default Rake task is configured to compile the Rust code and run tests. Simp $ bundle exec rake ``` -At this point you should start reading the docs for [`magnus`][magnus] to get familiar with the API. It is design to be +At this point you should start reading the docs for [`magnus`][magnus] to get familiar with the API. It is designed to be a safe and idiomatic wrapper around the Ruby C API. ## Next steps diff --git a/book/src/tutorial/publishing/cross-compilation.md b/book/src/tutorial/publishing/cross-compilation.md index 26384be0..2ee5e7fc 100644 --- a/book/src/tutorial/publishing/cross-compilation.md +++ b/book/src/tutorial/publishing/cross-compilation.md @@ -1,10 +1,10 @@ # Cross-Compilation Publishing native gem binaries is incredibly important for Ruby on Rust gems. No one likes seeing the infamous -`Compiling native extensions. This could take a while...` message when they install a gem. An in Rust, we all know that +`Compiling native extensions. This could take a while...` message when they install a gem. And in Rust, we all know that compiling can take a while... -It's important to make sure that your gem is as fast as possible to install, that why `rb-sys` is built from the ground +It's important to make sure that your gem is as fast as possible to install, that's why `rb-sys` is built from the ground up to support this use-case. `rb-sys` integrates seamlessly with [`rake-compiler`][rake-compiler] and [`rake-compiler-dock`][rcd]. By leveraging the hard-work of others, cross-compilation for Ruby gems is as simple and reliable as it would be for a C extension. @@ -14,16 +14,16 @@ reliable as it would be for a C extension. ## Using the `rb-sys-dock` helper The `rb-sys-dock` executable allows you to easily enter the Docker container used to cross compile your gem. You can use -you tool to build your gem, and then exit the container. The gem will be available in the `pkg` directory. +your tool to build your gem, and then exit the container. The gem will be available in the `pkg` directory. ```bash $ bundle exec rb-sys-dock -p aarch64-linux --build $ ls pkg # => my_gem_name-0.1.0-aarch64-linux.gem ``` -## Github Actions +## GitHub Actions -The [`oxi-test`][oxi-text] gem is meant to serve as the canonical example of how to setup cross gem compilation. Here's +The [`oxi-test`][oxi-test] gem is meant to serve as the canonical example of how to setup cross gem compilation. Here's a walkthrough of the important files to reference: 1. Setup the `Rake::ExtensionTask` in the [`Rakefile`](https://github.com/oxidize-rb/oxi-test/blob/main/Rakefile) @@ -48,5 +48,5 @@ a walkthrough of the important files to reference: [rake-compiler]: https://github.com/rake-compiler/rake-compiler [rcd]: https://github.com/rake-compiler/rake-compiler-dock -[oxi-test]: htttps://github.com/oxidize-rb/oxi-test +[oxi-test]: https://github.com/oxidize-rb/oxi-test [slack]: https://join.slack.com/t/oxidize-rb/shared_invite/zt-16zv5tqte-Vi7WfzxCesdo2TqF_RYBCw