Skip to main content

slicec/grammar/elements/
type_alias.rs

1// Copyright (c) ZeroC, Inc.
2
3use super::super::*;
4use crate::slice_file::Span;
5use crate::utils::ptr_util::WeakPtr;
6
7#[derive(Debug)]
8pub struct TypeAlias {
9    pub identifier: Identifier,
10    pub underlying: TypeRef,
11    pub scope: Scope,
12    pub attributes: Vec<WeakPtr<Attribute>>,
13    pub comment: Option<DocComment>,
14    pub span: Span,
15}
16
17impl AsTypes for TypeAlias {
18    fn concrete_type(&self) -> Types<'_> {
19        self.underlying.concrete_type()
20    }
21}
22
23impl Type for TypeAlias {
24    fn type_string(&self) -> String {
25        self.identifier().to_owned()
26    }
27}
28
29implement_Element_for!(TypeAlias, "type alias");
30implement_Attributable_for!(TypeAlias);
31implement_Entity_for!(TypeAlias);
32implement_Commentable_for!(TypeAlias);