Skip to content

Commit 140d16a

Browse files
committed
Fix tutorial-ffi tests
1 parent 5bca5f7 commit 140d16a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

doc/tutorial-ffi.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn sha1(data: ~str) -> ~str unsafe {
3030
let bytes = str::to_bytes(data);
3131
let hash = crypto::SHA1(vec::raw::to_ptr(bytes),
3232
vec::len(bytes) as c_uint, ptr::null());
33-
return as_hex(vec::raw::from_buf(hash, 20));
33+
return as_hex(vec::from_buf(hash, 20));
3434
}
3535
3636
fn main(args: ~[~str]) {
@@ -132,7 +132,7 @@ fn sha1(data: ~str) -> ~str {
132132
let bytes = str::to_bytes(data);
133133
let hash = crypto::SHA1(vec::raw::to_ptr(bytes),
134134
vec::len(bytes), ptr::null());
135-
return as_hex(vec::raw::from_buf(hash, 20));
135+
return as_hex(vec::from_buf(hash, 20));
136136
}
137137
}
138138
~~~~
@@ -177,7 +177,7 @@ Let's look at our `sha1` function again.
177177
let bytes = str::to_bytes(data);
178178
let hash = crypto::SHA1(vec::raw::to_ptr(bytes),
179179
vec::len(bytes), ptr::null());
180-
return as_hex(vec::raw::from_buf(hash, 20));
180+
return as_hex(vec::from_buf(hash, 20));
181181
# }
182182
# }
183183
~~~~
@@ -198,7 +198,7 @@ unsafe null pointer of type `*u8`. (Rust generics are awesome
198198
like that: they can take the right form depending on the type that they
199199
are expected to return.)
200200

201-
Finally, `vec::raw::from_buf` builds up a new `~[u8]` from the
201+
Finally, `vec::from_buf` builds up a new `~[u8]` from the
202202
unsafe pointer that `SHA1` returned. SHA1 digests are always
203203
twenty bytes long, so we can pass `20` for the length of the new
204204
vector.

0 commit comments

Comments
 (0)