pub enum Storage {
Automatic,
Static {
item_name: String,
exported: bool,
},
ThreadLocal {
item_name: String,
exported: bool,
},
Extern {
item_name: String,
},
}Expand description
Where an object lives, and how it is generated.
Variants§
Automatic
A let binding: a local variable or a parameter.
Static
A static mut item: a file-scope variable or a function-local static.
Fields
ThreadLocal
A thread_local! item: an object declared _Thread_local,
thread_local or __thread.
C gives it static storage duration and one instance per thread, which
is exactly what std::thread_local! provides. The item holds an
UnsafeCell<T>, and every access goes through the *mut T its with
hands out — valid for as long as the current thread’s copy is, which is
the lifetime C promises. It is the third construct whose expansion
needs more than core, after variable length arrays and alloca.
Fields
exported: boolWhether the item is pub; see Storage::Static.
Extern
An object defined outside the translation unit, declared in the
expansion’s extern block.