# Struct ocl::Event [−] [src]

    #[repr(C)]
    #[must_use = "futures do nothing unless polled"]
    pub struct Event(_);

An event representing a command or user created event.

## Methods

### `impl Event`
[src]

#### `pub fn empty() -> Event`
[src]

Creates a new, empty (null) event which must be filled by a command, associating the event with it.

#### `pub fn user<C: ClContextPtr>(context: C) -> OclCoreResult<Event>`
[src]

Creates a new, empty event which must be filled by a newly initiated command, associating the event with it.

#### `pub fn is_empty(&self) -> bool`
[src]

Returns true if this event is 'empty' and has not yet been associated with a command.

#### `pub fn set_unpark_callback(&self) -> OclCoreResult<()>`
[src]

Sets a callback function to trigger upon completion of this event which will unpark the current task.

To be used within the context of a futures task.

## Panics

This function will panic if a task is not currently being executed. That is, this method can be dangerous to call outside of an implementation of poll.

#### `pub unsafe fn register_event_relay(
&self,
user_event: Event
) -> OclCoreResult<()>`
[src]

Registers a user event to have its status set to complete (`CommandExecutionStatus::Complete`) immediately upon completion of this event.

## Deadlocks

Due to the nature of OpenCL queue implementations, care must be taken when using this function. OpenCL queue deadlocks may occur.

OpenCL queues generally use one thread per queue for the purposes of callbacks, etc. As a rule of thumb, ensure that any OpenCL commands preceding the causation/source event (`self`) are in a separate queue from any commands with the dependent/target event (`user_event`).

## Safety

The caller must ensure that `user_event` was created with `Event::user()` and that it's status is `CommandExecutionStatus::Submitted` (the default upon creation).

#### `pub fn info(&self, info_kind: EventInfo) -> OclCoreResult<EventInfoResult>`
[src]

Returns info about the event.

#### `pub fn profiling_info(
&self,
info_kind: ProfilingInfo
) -> OclCoreResult<ProfilingInfoResult>`
[src]

Returns info about the event.

#### `pub fn queue_core(&self) -> OclCoreResult<CommandQueueCore>`
[src]

Returns this event's associated command queue.

#### `pub fn as_core(&self) -> &EventCore`
[src]

Returns a reference to the core pointer wrapper, usable by functions in the `core` module.

#### `pub fn into_raw(self) -> cl_event`
[src]

Consumes the `Event`, returning the wrapped `cl_event` pointer.

To avoid a memory leak the pointer must be converted back to an `Event` using `Event::from_raw`.

#### `pub unsafe fn from_raw(ptr: cl_event) -> Event`
[src]

Constructs an `Event` from a raw `cl_event` pointer.

The raw pointer must have been previously returned by a call to a `Event::into_raw`.

## Methods from Deref<Target = EventCore>

#### `pub fn set_complete(&self) -> Result<(), Error>`
[src]

Sets this user created event to `CommandExecutionStatus::Complete`.

Will return an error if this event is not a 'user' event (created with `::user()`).

#### `pub fn is_complete(&self) -> Result<bool, Error>`
[src]

Queries the command status associated with this event and returns true if it is complete, false if incomplete or upon error.

This is the fastest possible way to determine event status.

#### `pub fn wait_for(&self) -> Result<(), Error>`
[src]

Causes the command queue to wait until this event is complete before returning.

#### `pub fn is_null(&self) -> bool`
[src]

Returns whether or not this event is associated with a command or is a user event.

#### `pub fn is_valid(&self) -> bool`
[src]

[FIXME]: ADD VALIDITY CHECK BY CALLING '_INFO' OR SOMETHING: NULL CHECK IS NOT ENOUGH

This still leads to crazy segfaults when non-event pointers (random whatever addresses) are passed. Need better check.

#### `pub unsafe fn set_callback(
&self,
callback_receiver: extern "C" fn(*mut c_void, i32, *mut c_void),
user_data_ptr: *mut c_void
) -> Result<(), Error>`
[src]

Sets a callback function, `callback_receiver`, to trigger upon completion of this event with an optional pointer to user data.

The callback function must have a signature matching: `extern "C" fn (ffi::cl_event, i32, *mut libc::c_void)`

# Safety

`user_data` must be guaranteed to still exist if and when `callback_receiver` is ever called.

TODO: Create a safer type wrapper for `callback_receiver` (using an `Arc`?, etc.) within `ocl`.

#### `pub fn context(&self) -> Result<Context, Error>`
[src]

Returns the `Context` associated with this event.

#### `pub unsafe fn as_ptr_ref(&self) -> &*mut c_void`
[src]

Returns an immutable reference to a pointer, do not deref and store it unless you will manage its associated reference count carefully.

### Warning

DO NOT store this pointer.

DO NOT send this pointer across threads unless you are incrementing the reference count before sending and decrementing after sending.

Use `::into_raw` for these purposes. Thank you.

#### `pub unsafe fn as_ptr_mut(&mut self) -> &mut *mut c_void`
[src]

Returns a mutable reference to a pointer, do not deref then modify or store it unless you will manage its associated reference count carefully.

### Warning

DO NOT store this pointer.

DO NOT send this pointer across threads unless you are incrementing the reference count before sending and decrementing after sending.

Use `::into_raw` for these purposes. Thank you.

## Trait Implementations

### `impl Clone for Event`
[src]

#### `fn clone(&self) -> Event`
[src]

Returns a copy of the value. Read more

#### `fn clone_from(&mut self, source: &Self)`
1.0.0
[src]

Performs copy-assignment from `source`. Read more

### `impl Debug for Event`
[src]

#### `fn fmt(&self, __arg_0: &mut Formatter) -> Result`
[src]

Formats the value using the given formatter. Read more

### `impl Hash for Event`
[src]

#### `fn hash<__H: Hasher>(&self, __arg_0: &mut __H)`
[src]

Feeds this value into the given [`Hasher`]. Read more

#### `fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,`
1.3.0
[src]

Feeds a slice of this type into the given [`Hasher`]. Read more

### `impl PartialEq for Event`
[src]

#### `fn eq(&self, __arg_0: &Event) -> bool`
[src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `fn ne(&self, __arg_0: &Event) -> bool`
[src]

This method tests for `!=`.

### `impl Eq for Event`
[src]

### `impl From<EventCore> for Event`
[src]

#### `fn from(ev: EventCore) -> Event`
[src]

Performs the conversion.

### `impl From<Event> for EventCore`
[src]

#### `fn from(ev: Event) -> EventCore`
[src]

Performs the conversion.

### `impl Default for Event`
[src]

#### `fn default() -> Event`
[src]

Returns the "default value" for a type. Read more

### `impl Deref for Event`
[src]

#### `type Target = EventCore`

The resulting type after dereferencing.

#### `fn deref(&self) -> &EventCore`
[src]

Dereferences the value.

### `impl DerefMut for Event`
[src]

#### `fn deref_mut(&mut self) -> &mut EventCore`
[src]

Mutably dereferences the value.

### `impl AsRef<EventCore> for Event`
[src]

#### `fn as_ref(&self) -> &EventCore`
[src]

Performs the conversion.

### `impl Display for Event`
[src]

#### `fn fmt(&self, f: &mut Formatter) -> Result`
[src]

Formats the value using the given formatter. Read more

### `impl<'e> ClEventPtrRef<'e> for Event`
[src]

#### `unsafe fn as_ptr_ref(&'e self) -> &'e cl_event`
[src]

### `impl<'a> ClNullEventPtr for &'a mut Event`
[src]

#### `fn alloc_new(&mut self) -> *mut cl_event`
[src]

#### `unsafe fn clone_from<E: AsRef<EventCore>>(&mut self, ev: E)`
[src]

### `impl ClWaitListPtr for Event`
[src]

#### `unsafe fn as_ptr_ptr(&self) -> *const cl_event`
[src]

Returns a pointer to the first pointer in this list.

#### `fn count(&self) -> u32`
[src]

Returns the number of items in this wait list.

### `impl<'a> ClWaitListPtr for &'a Event`
[src]

#### `unsafe fn as_ptr_ptr(&self) -> *const cl_event`
[src]

Returns a pointer to the first pointer in this list.

#### `fn count(&self) -> u32`
[src]

Returns the number of items in this wait list.

### `impl Future for Event`
[src]

#### `type Item = ()`

The type of value that this future will resolved with if it is successful. Read more

#### `type Error = OclError`

The type of error that this future will resolve with if it fails in a normal fashion. Read more

#### `fn poll(&mut self) -> Poll<Self::Item, Self::Error>`
[src]

Query this future to see if its value has become available, registering interest if it is not. Read more

#### `fn wait(self) -> Result<Self::Item, Self::Error>`
[src]

Block the current thread until this future is resolved. Read more

#### `fn map<F, U>(self, f: F) -> Map<Self, F> where
F: FnOnce(Self::Item) -> U,`
[src]

Map this future's result to a different type, returning a new future of the resulting type. Read more

#### `fn map_err<F, E>(self, f: F) -> MapErr<Self, F> where
F: FnOnce(Self::Error) -> E,`
[src]

Map this future's error to a different error, returning a new future. Read more

#### `fn from_err<E>(self) -> FromErr<Self, E> where
E: From<Self::Error>,`
[src]

Map this future's error to any error implementing `From` for this future's `Error`, returning a new future. Read more

#### `fn then<F, B>(self, f: F) -> Then<Self, B, F> where
B: IntoFuture,
F: FnOnce(Result<Self::Item, Self::Error>) -> B,`
[src]

Chain on a computation for when a future finished, passing the result of the future to the provided closure `f`. Read more

#### `fn and_then<F, B>(self, f: F) -> AndThen<Self, B, F> where
B: IntoFuture<Error = Self::Error>,
F: FnOnce(Self::Item) -> B,`
[src]

Execute another future after this one has resolved successfully. Read more

#### `fn or_else<F, B>(self, f: F) -> OrElse<Self, B, F> where
B: IntoFuture<Item = Self::Item>,
F: FnOnce(Self::Error) -> B,`
[src]

Execute another future if this one resolves with an error. Read more

#### `fn select<B>(self, other: B) -> Select<Self, <B as IntoFuture>::Future> where
B: IntoFuture<Item = Self::Item, Error = Self::Error>,`
[src]

Waits for either one of two futures to complete. Read more

#### `fn select2<B>(self, other: B) -> Select2<Self, <B as IntoFuture>::Future> where
B: IntoFuture,`
[src]

Waits for either one of two differently-typed futures to complete. Read more

#### `fn join<B>(self, other: B) -> Join<Self, <B as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,`
[src]

Joins the result of two futures, waiting for them both to complete. Read more

#### `fn join3<B, C>(
self,
b: B,
c: C
) -> Join3<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,`
[src]

Same as `join`, but with more futures.

#### `fn join4<B, C, D>(
self,
b: B,
c: C,
d: D
) -> Join4<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,`
[src]

Same as `join`, but with more futures.

#### `fn join5<B, C, D, E>(
self,
b: B,
c: C,
d: D,
e: E
) -> Join5<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future, <E as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
E: IntoFuture<Error = Self::Error>,`
[src]

Same as `join`, but with more futures.

#### `fn into_stream(self) -> IntoStream<Self>`
[src]

Convert this future into a single element stream. Read more

#### `fn flatten(self) -> Flatten<Self> where
Self::Item: IntoFuture,
<Self::Item as IntoFuture>::Error: From<Self::Error>,`
[src]

Flatten the execution of this future when the successful result of this future is itself another future. Read more

#### `fn flatten_stream(self) -> FlattenStream<Self> where
Self::Item: Stream,
<Self::Item as Stream>::Error == Self::Error,`
[src]

Flatten the execution of this future when the successful result of this future is a stream. Read more

#### `fn fuse(self) -> Fuse<Self>`
[src]

Fuse a future such that `poll` will never again be called once it has completed. Read more

#### `fn inspect<F>(self, f: F) -> Inspect<Self, F> where
F: FnOnce(&Self::Item),`
[src]

Do something with the item of a future, passing it on. Read more

#### `fn catch_unwind(self) -> CatchUnwind<Self> where
Self: UnwindSafe,`
[src]

Catches unwinding panics while polling the future. Read more

#### `fn shared(self) -> Shared<Self>`
[src]

Create a cloneable handle to this future where all handles will resolve to the same result. Read more

### `impl<'a> From<Event> for EventArray`
[src]

#### `fn from(event: Event) -> EventArray`
[src]

Performs the conversion.

### `impl<'a> From<Event> for EventList`
[src]

#### `fn from(event: Event) -> EventList`
[src]

Performs the conversion.

### `impl<'a> From<Event> for ClWaitListPtrEnum<'a>`
[src]

#### `fn from(e: Event) -> ClWaitListPtrEnum<'a>`
[src]

Performs the conversion.

### `impl<'a> From<&'a Event> for ClWaitListPtrEnum<'a>`
[src]

#### `fn from(e: &'a Event) -> ClWaitListPtrEnum<'a>`
[src]

Performs the conversion.

### `impl<'a> From<&'a mut Event> for ClWaitListPtrEnum<'a>`
[src]

#### `fn from(e: &'a mut Event) -> ClWaitListPtrEnum<'a>`
[src]

Performs the conversion.

### `impl<'a> From<&'a mut Event> for ClNullEventPtrEnum<'a>`
[src]

#### `fn from(e: &'a mut Event) -> ClNullEventPtrEnum<'a>`
[src]

Performs the conversion.

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)