Module fq_std

Source
Expand description

This module contains unit structs that should be used inside quote! and spanned_quote! using the variable interpolation syntax in place of their equivalent structs and traits present in std.

To create hygienic proc macros, all the names must be its fully qualified form. These unit structs help us to not specify the fully qualified name every single time.

§Example

Instead of writing this:

quote!(
    fn get_id() -> Option<i32> {
        Some(0)
    }
);

Or this:

quote!(
    fn get_id() -> ::core::option::Option<i32> {
        ::core::option::Option::Some(0)
    }
);

We should write this:

use bevy_macro_utils::fq_std::FQOption;

quote!(
    fn get_id() -> #FQOption<i32> {
        #FQOption::Some(0)
    }
);

Structs§

FQAny
Fully Qualified (FQ) short name for core::any::Any
FQBox
Fully Qualified (FQ) short name for Box
FQClone
Fully Qualified (FQ) short name for Clone
FQDefault
Fully Qualified (FQ) short name for Default
FQOption
Fully Qualified (FQ) short name for Option
FQResult
Fully Qualified (FQ) short name for Result
FQSend
Fully Qualified (FQ) short name for Send
FQSync
Fully Qualified (FQ) short name for Sync