Skip to content

Commit 021fb20

Browse files
committed
Update docs a bit to talk about the destructor
1 parent f30eb51 commit 021fb20

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/lib.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ lazy_static! {
3030
# }
3131
```
3232
33-
# Semantic
33+
# Semantics
3434
3535
For a given `static ref NAME: TYPE = EXPR;`, the macro generates a unique type that
3636
implements `Deref<TYPE>` and stores it in a static with name `NAME`. (Attributes end up
@@ -40,8 +40,11 @@ On first deref, `EXPR` gets evaluated and stored internally, such that all furth
4040
can return a reference to the same object. Note that this can lead to deadlocks
4141
if you have multiple lazy statics that depend on each other in their initialization.
4242
43-
Like regular `static mut`s, this macro only works for types that fulfill the `Sync`
44-
trait.
43+
Apart from the lazy initialization, the resulting "static ref" variables
44+
have generally the same properties as regular "static" variables:
45+
46+
- Any type in them needs to fulfill the `Sync` trait.
47+
- If the type has a destructor, then it will not run when the process exits.
4548
4649
# Example
4750

0 commit comments

Comments
 (0)