miniextendr_macros/
deprecation.rs1use std::cell::RefCell;
11
12const WORKER_OPTIONS: ::std::thread::LocalKey<RefCell<Vec<proc_macro2::Span>>>
=
{
const __RUST_STD_INTERNAL_INIT: RefCell<Vec<proc_macro2::Span>> =
{ RefCell::new(Vec::new()) };
unsafe {
::std::thread::LocalKey::new(const {
if ::std::mem::needs_drop::<RefCell<Vec<proc_macro2::Span>>>()
{
|__rust_std_internal_init|
{
#[thread_local]
static __RUST_STD_INTERNAL_VAL:
::std::thread::local_impl::EagerStorage<RefCell<Vec<proc_macro2::Span>>>
=
::std::thread::local_impl::EagerStorage::new(__RUST_STD_INTERNAL_INIT);
__RUST_STD_INTERNAL_VAL.get()
}
} else {
|__rust_std_internal_init|
{
#[thread_local]
static __RUST_STD_INTERNAL_VAL:
RefCell<Vec<proc_macro2::Span>> =
__RUST_STD_INTERNAL_INIT;
&__RUST_STD_INTERNAL_VAL
}
}
})
}
};thread_local! {
13 static WORKER_OPTIONS: RefCell<Vec<proc_macro2::Span>> = const { RefCell::new(Vec::new()) };
14}
15
16pub(crate) fn worker_option(span: proc_macro2::Span) {
18 WORKER_OPTIONS.with(|spans| spans.borrow_mut().push(span));
19}
20
21pub(crate) fn take() -> proc_macro2::TokenStream {
24 WORKER_OPTIONS
25 .with(RefCell::take)
26 .into_iter()
27 .map(|span| {
28 {
let mut _s = ::quote::__private::TokenStream::new();
let _span: ::quote::__private::Span =
::quote::__private::get_span(span).__into_span();
::quote::__private::push_ident_spanned(&mut _s, _span, "const");
::quote::__private::push_underscore_spanned(&mut _s, _span);
::quote::__private::push_colon_spanned(&mut _s, _span);
::quote::__private::push_group_spanned(&mut _s, _span,
::quote::__private::Delimiter::Parenthesis,
{
let _: ::quote::__private::Span =
::quote::__private::get_span(_span).__into_span();
::quote::__private::TokenStream::new()
});
::quote::__private::push_eq_spanned(&mut _s, _span);
::quote::__private::push_colon2_spanned(&mut _s, _span);
::quote::__private::push_ident_spanned(&mut _s, _span, "miniextendr_api");
::quote::__private::push_colon2_spanned(&mut _s, _span);
::quote::__private::push_ident_spanned(&mut _s, _span, "worker");
::quote::__private::push_colon2_spanned(&mut _s, _span);
::quote::__private::push_ident_spanned(&mut _s, _span, "WORKER_OPTION");
::quote::__private::push_semi_spanned(&mut _s, _span);
_s
}quote::quote_spanned! {span=>
29 const _: () = ::miniextendr_api::worker::WORKER_OPTION;
30 }
31 })
32 .collect()
33}