Schedules this job to be polled, by converting it into a `JobRef` and handing that to the job's own `scheduler`. The `worker` param should be the same as calling `Worker::with_current`.
(self: Arc<Self>, worker: Option<&Worker>)
| 673 | let storage = unsafe { this.cast::<JobStorage<T>>().as_ref() }; |
| 674 | // SAFETY: We hold the claim, which recorded the scope. |
| 675 | let scope_raw: *const Scope<'scope, 'env> = |
| 676 | unsafe { storage.claimed() }.cast_const().cast(); |
| 677 | // SAFETY: The scope reference passed to this call keeps the scope from |
| 678 | // completing (and so from being freed) until we drop it below, so the |
| 679 | // scope is live for all of `'scope` as seen by the job. |
| 680 | let scope = unsafe { &*scope_raw }; |
| 681 | // SAFETY: We hold the claim, and this is its only run. |
| 682 | let result = |
| 683 | unsafe { storage.run_claimed(|job| job.run(scope, worker)) }; |
| 684 | // SAFETY: We hold the claim, and do not use the job after this. |
| 685 | unsafe { storage.release() }; |
| 686 | // SAFETY: The claim recorded the scope that the spawn took a reference |
| 687 | // to with `ScopePtr::into_raw`, and that reference is passed to this |
| 688 | // call. |
| 689 | let scope_ptr = unsafe { ScopePtr::from_raw(scope_raw) }; |
| 690 | if let Err(err) = result { |
| 691 | scope_ptr.store_panic(err); |
| 692 | } |
no test coverage detected