     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53

    //! Implements formating traits.

    macro_rules! impl_hex_fmt {
        ($id:ident, $elem_ty:ident) => {
            impl fmt::LowerHex for $id {
                fn fmt(&self, f: &mut fmt::Formatter)
                       -> fmt::Result {
                    write!(f, "{}(", stringify!($id))?;
                    let n = mem::size_of_val(self)
                        / mem::size_of::<$elem_ty>();
                    for i in 0..n {
                        if i > 0 {
                            write!(f, ", ")?;
                        }
                        self.extract(i).fmt(f)?;
                    }
                    write!(f, ")")
                }
            }
        }
    }

    #[cfg(test)]
    macro_rules! test_hex_fmt_impl {
        ($id:ident, $elem_ty:ident, $($values:expr),+) => {
            #[test]
            fn hex_fmt() {
                use ::std::prelude::v1::*;
                use ::coresimd::simd::$id;
                for &i in [$($values),+].iter() {
                    let vec = $id::splat(i as $elem_ty);

                    let s = format!("{:#x}", vec);
                    let beg = format!("{}(", stringify!($id));
                    assert!(s.starts_with(&beg));
                    assert!(s.ends_with(")"));
                    let s: Vec<String> = s.replace(&beg, "").replace(")", "").split(",")
                        .map(|v| v.trim().to_string()).collect();
                    assert_eq!(s.len(), $id::lanes());
                    for (index, ss) in s.into_iter().enumerate() {
                        assert_eq!(ss, format!("{:#x}", vec.extract(index)));
                    }
                }
            }
        }
    }

    #[cfg(test)]
    macro_rules! test_hex_fmt {
        ($id:ident, $elem_ty:ident) => {
            test_hex_fmt_impl!($id, $elem_ty, 0 as $elem_ty, !(0 as $elem_ty), (1 as $elem_ty));
        }
    }

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)