[][src]Trait photonix::focus::ReverseGet

pub trait ReverseGet<Value> {
    fn reverse_get(value: Value) -> Self;
}

Constructs the relevant enum variant based on the input.

This trait does not have a corresponding auto-derive macro.

Examples

 #[derive(Debug, PartialEq)]
 pub enum Deviation {
     Signed(i32),
     Unsigned(u32),
 }

 impl ReverseGet<i32> for Deviation {
     fn reverse_get(value: i32) -> Self {
         Deviation::Signed(value)
     }
 }

 impl ReverseGet<u32> for Deviation {
     fn reverse_get(value: u32) -> Self {
         Deviation::Unsigned(value)
     }
 }

 assert_eq!(Deviation::Signed(3), Deviation::reverse_get(3i32));
 assert_eq!(Deviation::Unsigned(3), Deviation::reverse_get(3u32));

Required methods

fn reverse_get(value: Value) -> Self

Loading content...

Implementors

Loading content...