1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use provider;
use backend::Backend;
pub trait Platform: PlatformClone {
fn new() -> Self where Self: Sized;
fn inline_detector(&self) -> Option<Box<Platform>>;
fn shell_detector(&self, &Backend) -> Option<Box<Platform>>;
fn get_provider(&self) -> Box<provider::Provider>;
}
pub trait PlatformClone {
fn clone_box(&self) -> Box<Platform>;
}
impl<T> PlatformClone for T
where T: 'static + Platform + Clone
{
fn clone_box(&self) -> Box<Platform> {
Box::new(self.clone())
}
}
impl Clone for Box<Platform> {
fn clone(&self) -> Box<Platform> {
self.clone_box()
}
}