File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 11[book ]
2- author = " The Rust Project Developers"
2+ authors = [ " The Rust Project Developers" ]
33title = " The Rustonomicon"
44description = " The Dark Arts of Advanced and Unsafe Rust Programming"
55
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ code and the unsafe code into two separate phases:
104104``` text
105105bubble_up(heap, index):
106106 let end_index = index;
107- while end_index != 0 && heap[end_index ] < heap[parent(end_index)]:
107+ while end_index != 0 && heap[index ] < heap[parent(end_index)]:
108108 end_index = parent(end_index)
109109
110110 let elem = heap[index]
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ libc = "0.2.0"
2525
2626Because [ snappy] ( https://github.com/google/snappy ) is a static library by default.
2727So there is no C++ std linked in the output artifact.
28- n order to use this foreign library in Rust, we have to manually specify that we want to link stdc++ in our project.
28+ In order to use this foreign library in Rust, we have to manually specify that we want to link stdc++ in our project.
2929The easiest way to do this is by setting up a build script.
3030
3131First edit ` Cargo.toml ` , inside ` package ` add ` build = "build.rs" ` :
@@ -90,7 +90,7 @@ The `extern` block can be extended to cover the entire snappy API:
9090use libc::{c_int, size_t};
9191
9292#[link(name = "snappy")]
93- unsafe extern {
93+ unsafe extern "C" {
9494 fn snappy_compress(input: *const u8,
9595 input_length: size_t,
9696 compressed: *mut u8,
You can’t perform that action at this time.
0 commit comments