Skip to content

Commit ceeb618

Browse files
committed
Replace nice &[Option<Deref<Target=Event>>] EventList impl with ugly &[Option<Ref<Rc<event>>>] because Rust doesn't know how to see Ref<Rc<D>> as a Deref<D> in our weird case in gpuarray-rs :(
1 parent 06b479a commit ceeb618

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/hl.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ use std::ops::Deref;
1010
use std::ptr;
1111
use std::string::String;
1212
use std::vec::Vec;
13+
use std::rc::Rc;
14+
use std::cell::Ref;
1315

1416
use cl;
1517
use cl::*;
@@ -850,7 +852,22 @@ impl<'r> EventList for &'r [Event] {
850852
}
851853
}
852854

853-
impl<'r, D: Deref<Target=Event>> EventList for &'r [Option<D>] {
855+
/*impl<'r, D: Deref<Target=Event>> EventList for &'r [Option<D>] {
856+
fn as_event_list<T, F>(&self, f: F) -> T
857+
where F: FnOnce(*const cl_event, cl_uint) -> T
858+
{
859+
let mut vec: Vec<cl_event> = Vec::with_capacity(self.len());
860+
for item in self.iter() {
861+
if let Some(ref item) = *item {
862+
vec.push(item.event);
863+
}
864+
}
865+
866+
f(vec.as_ptr(), vec.len() as cl_uint)
867+
}
868+
}*/
869+
870+
impl<'r, 's> EventList for &'r [Option<Ref<'s, Rc<Event>>>] {
854871
fn as_event_list<T, F>(&self, f: F) -> T
855872
where F: FnOnce(*const cl_event, cl_uint) -> T
856873
{

0 commit comments

Comments
 (0)