add drawing and pixel wands; add some methods to MagickWand
This commit is contained in:
27
src/conversions.rs
Normal file
27
src/conversions.rs
Normal file
@ -0,0 +1,27 @@
|
||||
use super::bindings;
|
||||
|
||||
pub trait FromRust<T> {
|
||||
fn from_rust(t: T) -> Self;
|
||||
}
|
||||
|
||||
impl FromRust<bool> for bindings::MagickBooleanType {
|
||||
fn from_rust(b: bool) -> Self {
|
||||
if b {
|
||||
bindings::MagickTrue
|
||||
} else {
|
||||
bindings::MagickFalse
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait ToMagick<T> {
|
||||
fn to_magick(self) -> T;
|
||||
}
|
||||
|
||||
impl<T, E> ToMagick<T> for E
|
||||
where T: FromRust<E>
|
||||
{
|
||||
fn to_magick(self) -> T {
|
||||
<T as FromRust<E>>::from_rust(self)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user