pub fn new<'b, T>(device: Device,
                      host_target_map: T,
                      reset_pin: Option<u8>) -> Result<Mapping>
    where
        T: IntoIterator<Item = &'b (u8, u8)>,
    {
        let numbering: HashMap<u8, u8> = host_target_map.into_iter()
            .map(|(h_pin, t_pin)| (*h_pin, *t_pin))
            .collect();
        let reset_pin_v = if let Some(pin) = reset_pin { vec![pin] } else { Vec::new() };

        let used_device_pins = numbering.iter()
            .map(|(_h, t)| *t)
            .chain(reset_pin_v.into_iter());
        device.has_pins(used_device_pins)?;

        Ok(Mapping {
            device,
            numbering,
            reset_pin,
        })
    }
/** Create a new `Mapping`.

    Returns and Ok(Mapping) or an error with the reason for the failure.

    # Examples
    ```ignore
    let mapping = Mapping::new(&device, &[(17, 23), (2, 13)]);
    ```
     */
Create a new `Mapping`.
Returns and Ok(Mapping) or an error with the reason for the failure.
Create a new ` Mapping ` . Returns and Ok ( Mapping ) or an error with the reason for the failure .
pub fn new<'b, T>(device: Device,
                      host_target_map: T,
                      reset_pin: Option<u8>) -> Result<Mapping>
    where
        T: IntoIterator<Item = &'b (u8, u8)>,
    {
        let numbering: HashMap<u8, u8> = host_target_map.into_iter()
            .map(|(h_pin, t_pin)| (*h_pin, *t_pin))
            .collect();
        let reset_pin_v = if let Some(pin) = reset_pin { vec![pin] } else { Vec::new() };
        let used_device_pins = numbering.iter()
            .map(|(_h, t)| *t)
            .chain(reset_pin_v.into_iter());
        device.has_pins(used_device_pins)?;
        Ok(Mapping {
            device,
            numbering,
            reset_pin,
        })
    }
pub fn new < ' b , T > ( device : Device , host_target_map : T , reset_pin : Option < u8 > ) -> Result < Mapping > where T : IntoIterator < Item = & ' b ( u8 , u8 ) > , { let numbering : HashMap < u8 , u8 > = host_target_map . into_iter ( ) . map ( | ( h_pin , t_pin ) | ( * h_pin , * t_pin ) ) . collect ( ) ; let reset_pin_v = if let Some ( pin ) = reset_pin { vec ! [ pin ] } else { Vec :: new ( ) } ; let used_device_pins = numbering . iter ( ) . map ( | ( _h , t ) | * t ) . chain ( reset_pin_v . into_iter ( ) ) ; device . has_pins ( used_device_pins ) ? ; Ok ( Mapping { device , numbering , reset_pin , } ) }
Create a new `Mapping`.
Create a new ` Mapping ` .
device
Device
host_target_map
T
reset_pin
Option<u8>
device
Device
host_target_map
T
reset_pin
Option<u8>
examples
None