Merge branch 'master' of https://github.com/cfsamson/books-futures-explained
This commit is contained in:
@@ -139,7 +139,7 @@ fn main() {
|
||||
// length of the array is encoded in the array itself as the second value.
|
||||
let vtable = vec![
|
||||
0, // pointer to `Drop` (which we're not implementing here)
|
||||
6, // lenght of vtable
|
||||
6, // length of vtable
|
||||
8, // alignment
|
||||
|
||||
// we need to make sure we add these in the same order as defined in the Trait.
|
||||
|
||||
@@ -326,7 +326,7 @@ Let's see what happens if we run our example now:
|
||||
pub fn main() {
|
||||
// test1 is safe to move before we initialize it
|
||||
let mut test1 = Test::new("test1");
|
||||
// Notice how we shadow `test1` to prevent it from beeing accessed again
|
||||
// Notice how we shadow `test1` to prevent it from being accessed again
|
||||
let mut test1 = unsafe { Pin::new_unchecked(&mut test1) };
|
||||
Test::init(test1.as_mut());
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ const VTABLE: RawWakerVTable = unsafe {
|
||||
)
|
||||
};
|
||||
|
||||
// Instead of implementing this on the `MyWaker` oject in `impl Mywaker...` we
|
||||
// Instead of implementing this on the `MyWaker` object in `impl Mywaker...` we
|
||||
// just use this pattern instead since it saves us some lines of code.
|
||||
fn waker_into_waker(s: *const MyWaker) -> Waker {
|
||||
let raw_waker = RawWaker::new(s as *const (), &VTABLE);
|
||||
|
||||
Reference in New Issue
Block a user