     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
    54
    55
    56
    57

    use {Tokens, ToTokens};
    use std::borrow::Cow;
    use std::fmt;

    /// An identifier that should be interpolated without quotes.
    #[derive(Debug, Clone, Eq, Hash)]
    pub struct Ident(String);

    impl Ident {
        pub fn new<T: Into<Ident>>(t: T) -> Self {
            t.into()
        }
    }

    impl<'a> From<&'a str> for Ident {
        fn from(s: &str) -> Self {
            Ident(s.to_owned())
        }
    }

    impl<'a> From<Cow<'a, str>> for Ident {
        fn from(s: Cow<'a, str>) -> Self {
            Ident(s.into_owned())
        }
    }

    impl From<String> for Ident {
        fn from(s: String) -> Self {
            Ident(s)
        }
    }

    impl AsRef<str> for Ident {
        fn as_ref(&self) -> &str {
            &self.0
        }
    }

    impl fmt::Display for Ident {
        fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
            self.0.fmt(formatter)
        }
    }

    impl<T: ?Sized> PartialEq<T> for Ident
        where T: AsRef<str>
    {
        fn eq(&self, other: &T) -> bool {
            self.0 == other.as_ref()
        }
    }

    impl ToTokens for Ident {
        fn to_tokens(&self, tokens: &mut Tokens) {
            tokens.append(self.as_ref())
        }
    }

# 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`)