Implement clone manually

The Clone implementation for Handle does not need the T: Clone bound.
This commit is contained in:
Yin Guanhap
2020-01-24 11:18:48 +08:00
committed by Richard Hozák
parent ad12815d2f
commit 4a8eb623a4

View File

@@ -483,13 +483,22 @@ impl<'a, T> Drop for WebView<'a, T> {
/// A thread-safe handle to a [`WebView`] instance. Used to dispatch closures onto its task queue.
///
/// [`WebView`]: struct.WebView.html
#[derive(Clone)]
pub struct Handle<T> {
inner: *mut CWebView,
live: Weak<RwLock<()>>,
_phantom: PhantomData<T>,
}
impl<T> Clone for Handle<T> {
fn clone(&self) -> Self {
Handle {
inner: self.inner,
live: self.live.clone(),
_phantom: PhantomData,
}
}
}
impl<T> Handle<T> {
/// Schedules a closure to be run on the [`WebView`] thread.
///