]>
git.proxmox.com Git - rustc.git/blob - src/vendor/quote/src/ident.rs
1 use {Tokens, ToTokens}
;
5 /// An identifier that should be interpolated without quotes.
6 #[derive(Debug, Clone, Eq, Hash)]
7 pub struct Ident(String
);
10 pub fn new
<T
: Into
<Ident
>>(t
: T
) -> Self {
15 impl<'a
> From
<&'a
str> for Ident
{
16 fn from(s
: &str) -> Self {
21 impl<'a
> From
<Cow
<'a
, str>> for Ident
{
22 fn from(s
: Cow
<'a
, str>) -> Self {
27 impl From
<String
> for Ident
{
28 fn from(s
: String
) -> Self {
33 impl AsRef
<str> for Ident
{
34 fn as_ref(&self) -> &str {
39 impl fmt
::Display
for Ident
{
40 fn fmt(&self, formatter
: &mut fmt
::Formatter
) -> Result
<(), fmt
::Error
> {
45 impl<T
: ?Sized
> PartialEq
<T
> for Ident
48 fn eq(&self, other
: &T
) -> bool
{
49 self.0 == other
.as_ref()
53 impl ToTokens
for Ident
{
54 fn to_tokens(&self, tokens
: &mut Tokens
) {
55 tokens
.append(self.as_ref())