pub struct MacroDef {
pub name: InternedStr,
pub kind: MacroKind,
pub body: Vec<Token>,
pub def_loc: SourceLocation,
pub leading_comments: Vec<Comment>,
pub is_builtin: bool,
pub is_target: bool,
pub has_token_pasting: bool,
}Expand description
マクロ定義
Fields§
§name: InternedStrマクロ名
kind: MacroKindマクロの種類
body: Vec<Token>置換トークン列
def_loc: SourceLocation定義された位置(ファイル追跡用)
leading_comments: Vec<Comment>定義前のコメント(将来のドキュメント生成用)
is_builtin: boolビルトインマクロかどうか
is_target: boolターゲットディレクトリで定義されたマクロかどうか
has_token_pasting: boolマクロ本体にトークン連結 (##) を含むか
Implementations§
Source§impl MacroDef
impl MacroDef
Sourcepub fn object(
name: InternedStr,
body: Vec<Token>,
def_loc: SourceLocation,
) -> Self
pub fn object( name: InternedStr, body: Vec<Token>, def_loc: SourceLocation, ) -> Self
新しいオブジェクトマクロを作成
Sourcepub fn function(
name: InternedStr,
params: Vec<InternedStr>,
is_variadic: bool,
body: Vec<Token>,
def_loc: SourceLocation,
) -> Self
pub fn function( name: InternedStr, params: Vec<InternedStr>, is_variadic: bool, body: Vec<Token>, def_loc: SourceLocation, ) -> Self
新しい関数マクロを作成
Sourcepub fn with_target(self, is_target: bool) -> Self
pub fn with_target(self, is_target: bool) -> Self
ターゲットディレクトリのマクロとして設定
Sourcepub fn with_comments(self, comments: Vec<Comment>) -> Self
pub fn with_comments(self, comments: Vec<Comment>) -> Self
コメント付きで作成
Sourcepub fn as_builtin(self) -> Self
pub fn as_builtin(self) -> Self
ビルトインとしてマーク
Sourcepub fn is_function(&self) -> bool
pub fn is_function(&self) -> bool
関数マクロかどうか
Sourcepub fn param_count(&self) -> usize
pub fn param_count(&self) -> usize
パラメータ数を取得(オブジェクトマクロなら0)
Sourcepub fn is_variadic(&self) -> bool
pub fn is_variadic(&self) -> bool
可変引数マクロかどうか
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MacroDef
impl RefUnwindSafe for MacroDef
impl Send for MacroDef
impl Sync for MacroDef
impl Unpin for MacroDef
impl UnsafeUnpin for MacroDef
impl UnwindSafe for MacroDef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more