2018-03-15 06:54:18 -04:00
|
|
|
pub use animation::AnimatedSignalVec;
|
|
|
|
|
|
|
|
|
2018-04-25 19:01:52 -04:00
|
|
|
pub trait Mixin<A> {
|
|
|
|
fn apply(&self, builder: A) -> A;
|
2018-02-25 06:58:20 -05:00
|
|
|
}
|
|
|
|
|
2018-04-25 19:01:52 -04:00
|
|
|
impl<A, F> Mixin<A> for F where F: Fn(A) -> A {
|
2018-02-25 06:58:20 -05:00
|
|
|
#[inline]
|
2018-04-25 19:01:52 -04:00
|
|
|
fn apply(&self, builder: A) -> A {
|
|
|
|
self(builder)
|
2018-02-25 06:58:20 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-04-25 19:01:52 -04:00
|
|
|
pub trait AsStr {
|
|
|
|
fn as_str(&self) -> &str;
|
2018-02-25 06:58:20 -05:00
|
|
|
}
|
|
|
|
|
2018-04-25 19:01:52 -04:00
|
|
|
impl AsStr for String {
|
2018-02-25 06:58:20 -05:00
|
|
|
#[inline]
|
2018-04-25 19:01:52 -04:00
|
|
|
fn as_str(&self) -> &str {
|
|
|
|
self.as_str()
|
2018-02-25 06:58:20 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-25 19:01:52 -04:00
|
|
|
impl<'a> AsStr for &'a str {
|
2018-02-25 06:58:20 -05:00
|
|
|
#[inline]
|
2018-04-25 19:01:52 -04:00
|
|
|
fn as_str(&self) -> &str {
|
|
|
|
self
|
2018-02-25 06:58:20 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-04-25 19:01:52 -04:00
|
|
|
pub trait AsOptionStr {
|
|
|
|
fn as_option_str(&self) -> Option<&str>;
|
2018-02-25 06:58:20 -05:00
|
|
|
}
|
|
|
|
|
2018-04-25 19:01:52 -04:00
|
|
|
impl AsOptionStr for Option<String> {
|
2018-02-25 06:58:20 -05:00
|
|
|
#[inline]
|
2018-04-25 19:01:52 -04:00
|
|
|
fn as_option_str(&self) -> Option<&str> {
|
|
|
|
self.as_ref().map(|x| x.as_str())
|
2018-02-25 06:58:20 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-25 19:01:52 -04:00
|
|
|
impl<'a> AsOptionStr for Option<&'a str> {
|
2018-03-01 08:39:58 -05:00
|
|
|
#[inline]
|
2018-04-25 19:01:52 -04:00
|
|
|
fn as_option_str(&self) -> Option<&str> {
|
|
|
|
*self
|
2018-03-01 08:39:58 -05:00
|
|
|
}
|
2018-02-25 06:58:20 -05:00
|
|
|
}
|