compose-idents 0.3.0

A Rust macro for generating new identifiers (names of variables, functions, traits, etc) by concatenating one or more arbitrary parts and applying other manipulations.
Documentation
use crate::ast::{Ast, NodeId};
use proc_macro2::{Ident, Span};

/// Alias declaration.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Alias {
    id: NodeId,
    ident: Ident,
}

impl Ast for Alias {
    fn id(&self) -> NodeId {
        self.id
    }
    fn span(&self) -> Span {
        self.ident.span()
    }
}

impl Alias {
    /// Creates a new [`Alias`] with the given identifier.
    pub fn new(id: NodeId, ident: Ident) -> Self {
        Self { id, ident }
    }

    /// Reads the identifier.
    pub fn ident(&self) -> &Ident {
        &self.ident
    }
}