Struct ocl::ReadGuard [] [src]

pub struct ReadGuard<T> { /* fields omitted */ }

Allows access to the data contained within a lock just like a mutex guard.

Methods

impl<T> ReadGuard<T>
[src]

Triggers the release event and releases the lock held by this ReadGuard before returning the original RwVec.

Returns a reference to the event previously set using create_release_event on the FutureReadGuard which preceded this ReadGuard. The event can be manually 'triggered' by calling ...set_complete()... or used normally (as a wait event) by subsequent commands. If the event is not manually completed it will be automatically set complete when this ReadGuard is dropped.

Methods from Deref<Target = Vec<T>>

Returns the number of elements the vector can hold without reallocating.

Examples

let vec: Vec<i32> = Vec::with_capacity(10);
assert_eq!(vec.capacity(), 10);

Converts the vector into Box<[T]>.

Note that this will drop any excess capacity. Calling this and converting back to a vector with into_vec is equivalent to calling shrink_to_fit.

Examples

let v = vec![1, 2, 3];

let slice = v.into_boxed_slice();

Any excess capacity is removed:

let mut vec = Vec::with_capacity(10);
vec.extend([1, 2, 3].iter().cloned());

assert_eq!(vec.capacity(), 10);
let slice = vec.into_boxed_slice();
assert_eq!(slice.into_vec().capacity(), 3);

Extracts a slice containing the entire vector.

Equivalent to &s[..].

Examples

use std::io::{self, Write};
let buffer = vec![1, 2, 3, 5, 8];
io::sink().write(buffer.as_slice()).unwrap();

Returns the number of elements in the vector.

Examples

let a = vec![1, 2, 3];
assert_eq!(a.len(), 3);

Returns true if the vector contains no elements.

Examples

let mut v = Vec::new();
assert!(v.is_empty());

v.push(1);
assert!(!v.is_empty());

Trait Implementations

impl<T: Debug> Debug for ReadGuard<T>
[src]

Formats the value using the given formatter.

impl<T> Deref for ReadGuard<T>
[src]

The resulting type after dereferencing

The method called to dereference a value

impl<T> Drop for ReadGuard<T>
[src]

A method called when the value goes out of scope. Read more