mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
workaround for broken cross-crate generic newtype structs
add issue number for newtype struct issue
This commit is contained in:
parent
c804db0f93
commit
9df66ff021
2 changed files with 20 additions and 5 deletions
|
@ -58,13 +58,28 @@ pub fn BufferRequest(screen_rect: Rect<uint>, page_rect: Rect<f32>) -> BufferReq
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME(rust#9155): this should be a newtype struct, but
|
||||
// generic newtypes ICE when compiled cross-crate
|
||||
#[deriving(Clone)]
|
||||
pub struct RenderChan<T>{chan:SharedChan<Msg<T>>}
|
||||
impl<T> RenderChan<T> {
|
||||
pub struct RenderChan<T> {
|
||||
chan: SharedChan<Msg<T>>,
|
||||
}
|
||||
impl<T: Send> RenderChan<T> {
|
||||
pub fn new(chan: Chan<Msg<T>>) -> RenderChan<T> {
|
||||
RenderChan{chan:SharedChan::new(chan)}
|
||||
RenderChan {
|
||||
chan: SharedChan::new(chan),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<T: Send> GenericChan<Msg<T>> for RenderChan<T> {
|
||||
fn send(&self, msg: Msg<T>) {
|
||||
assert!(self.try_send(msg), "RenderChan.send: render port closed")
|
||||
}
|
||||
}
|
||||
impl<T: Send> GenericSmartChan<Msg<T>> for RenderChan<T> {
|
||||
fn try_send(&self, msg: Msg<T>) -> bool {
|
||||
self.chan.try_send(msg)
|
||||
}
|
||||
pub fn send(&self, msg: Msg<T>) { self.chan.send(msg) }
|
||||
}
|
||||
|
||||
struct RenderTask<C,T> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue