Struct rayon_core::job::JobRef
source · pub(crate) struct JobRef {
pointer: *const (),
execute_fn: unsafe fn(_: *const ()),
}
Expand description
Effectively a Job trait object. Each JobRef must be executed exactly once, or else data may leak.
Internally, we store the job’s data in a *const ()
pointer. The
true type is something like *const StackJob<...>
, but we hide
it. We also carry the “execute fn” from the Job
trait.
Fields§
§pointer: *const ()
§execute_fn: unsafe fn(_: *const ())
Implementations§
source§impl JobRef
impl JobRef
sourcepub(crate) unsafe fn new<T>(data: *const T) -> JobRefwhere
T: Job,
pub(crate) unsafe fn new<T>(data: *const T) -> JobRefwhere
T: Job,
Unsafe: caller asserts that data
will remain valid until the
job is executed.
sourcepub(crate) fn id(&self) -> impl Eq
pub(crate) fn id(&self) -> impl Eq
Returns an opaque handle that can be saved and compared,
without making JobRef
itself Copy + Eq
.
pub(crate) unsafe fn execute(self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JobRef
impl RefUnwindSafe for JobRef
impl Unpin for JobRef
impl UnwindSafe for JobRef
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more