Skip to main content

grp_core/
animation.rs

1/// # Animation
2/// This trait is meant to allow you to show progress during the platform interaction. 
3pub trait Animation {
4    fn new<T: Into<String>>(message: T) -> Box<Self>;
5    fn finish_with_error<T: Into<String>>(&self, message: T);
6    fn finish_with_warning<T: Into<String>>(&self, message: T);
7    fn finish_with_success<T: Into<String>>(&self, message: T);
8    fn change_message<T: Into<String>>(&self, message: T);
9}
10
11/// # animation::None
12/// default implementation for a None animation. use it when its not necesary show 
13/// any information to the user. 
14pub struct None;
15
16impl None { fn new() -> Box<None> { Box::new(None) } }
17
18#[allow(unused_variables)]
19impl Animation for None {
20    fn new<T: Into<String>>(message: T) -> Box<Self> { Self::new() }
21    fn finish_with_error<T: Into<String>>(&self, message: T) { }
22    fn finish_with_warning<T: Into<String>>(&self, message: T) {  }
23    fn finish_with_success<T: Into<String>>(&self, message: T) {  }
24    fn change_message<T: Into<String>>(&self, message: T) {  }
25}