зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1449034 - Update Rust crates to use lazy_static 1.0. r=ted
MozReview-Commit-ID: 4u4OQFBaURV --HG-- extra : rebase_source : f7a4f89d275777a036ca08dad42b0a17e9c7eb8e
This commit is contained in:
Родитель
4842bb9a9c
Коммит
61e9479fbb
|
@ -333,19 +333,19 @@ name = "crossbeam-deque"
|
|||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"crossbeam-epoch 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"arrayvec 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"scopeguard 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -501,12 +501,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dwrote"
|
||||
version = "0.4.1"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.27 (git+https://github.com/gankro/serde?branch=deserialize_from_enums4)",
|
||||
|
@ -845,7 +845,7 @@ dependencies = [
|
|||
"cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mozjs_sys 0.0.0",
|
||||
|
@ -871,11 +871,6 @@ name = "language-tags"
|
|||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.0.0"
|
||||
|
@ -913,7 +908,7 @@ dependencies = [
|
|||
name = "libudev-sys"
|
||||
version = "0.1.3"
|
||||
dependencies = [
|
||||
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -1435,7 +1430,7 @@ dependencies = [
|
|||
"aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -1784,10 +1779,10 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "0.3.4"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -2025,7 +2020,7 @@ dependencies = [
|
|||
"core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-text 9.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dwrote 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dwrote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.17.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"freetype 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2053,7 +2048,7 @@ dependencies = [
|
|||
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dwrote 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dwrote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.17.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.27 (git+https://github.com/gankro/serde?branch=deserialize_from_enums4)",
|
||||
|
@ -2067,7 +2062,7 @@ dependencies = [
|
|||
"app_units 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dwrote 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dwrote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.17.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"foreign-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2162,7 +2157,7 @@ dependencies = [
|
|||
name = "xpcom_macros"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -2216,7 +2211,7 @@ dependencies = [
|
|||
"checksum cose-c 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "49726015ab0ca765144fcca61e4a7a543a16b795a777fa53f554da2fffff9a94"
|
||||
"checksum crc 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bd5d02c0aac6bd68393ed69e00bbc2457f3e89075c6349db7189618dc4ddc1d7"
|
||||
"checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3"
|
||||
"checksum crossbeam-epoch 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "59796cc6cbbdc6bb319161349db0c3250ec73ec7fcb763a51065ec4e2e158552"
|
||||
"checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150"
|
||||
"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9"
|
||||
"checksum cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8a807ac3ab7a217829c2a3b65732b926b2befe6a35f33b4bf8b503692430f223"
|
||||
"checksum cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "079adec4af52bb5275eadd004292028c79eb3c5f5b4ee8086a36d4197032f6df"
|
||||
|
@ -2232,7 +2227,7 @@ dependencies = [
|
|||
"checksum debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9a032eac705ca39214d169f83e3d3da290af06d8d1d344d1baad2fd002dca4b3"
|
||||
"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
|
||||
"checksum dtoa-short 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "068d4026697c1a18f0b0bb8cfcad1b0c151b90d8edb9bf4c235ad68128920d1d"
|
||||
"checksum dwrote 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a207eb7b40e25d1d28dc679f451d321fb6954b73ceaa47986702575865469461"
|
||||
"checksum dwrote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b26e30aaa6bf31ec830db15fec14ed04f0f2ecfcc486ecfce88c55d3389b237f"
|
||||
"checksum either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18785c1ba806c258137c937e44ada9ee7e69a37e3c72077542cd2f069d78562a"
|
||||
"checksum encoding_c 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "93ec52324ca72f423237a413ca0e1c60654c8b3d0934fcd5fd888508dfcc4ba7"
|
||||
"checksum encoding_rs 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "98fd0f24d1fb71a4a6b9330c8ca04cbd4e7cc5d846b54ca74ff376bc7c9f798d"
|
||||
|
@ -2264,7 +2259,6 @@ dependencies = [
|
|||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
"checksum khronos_api 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d867c645cfeb8a7fec503731679eac03ac11b7105aa5a71cb8f8ee5271636add"
|
||||
"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
|
||||
"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
|
||||
"checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d"
|
||||
"checksum lazycell 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce12306c4739d86ee97c23139f3a34ddf0387bbf181bc7929d287025a8c3ef6b"
|
||||
"checksum libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)" = "f54263ad99207254cf58b5f701ecb432c717445ea2ee8af387334bdd1a03fdff"
|
||||
|
@ -2346,7 +2340,7 @@ dependencies = [
|
|||
"checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6"
|
||||
"checksum term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2b6b55df3198cc93372e85dd2ed817f0e38ce8cc0f22eb32391bfad9c4bf209"
|
||||
"checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693"
|
||||
"checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14"
|
||||
"checksum thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963"
|
||||
"checksum thread_profiler 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf947d192a9be60ef5131cc7a4648886ba89d712f16700ebbf80c8a69d05d48f"
|
||||
"checksum time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d788d3aa77bc0ef3e9621256885555368b47bd495c13dd2e7413c89f845520"
|
||||
"checksum tokio-core 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "febd81b3e2ef615c6c8077347b33f3f3deec3d708ecd08194c9707b7a1eccfc9"
|
||||
|
|
|
@ -5,5 +5,5 @@ authors = ["Tim Taubert <ttaubert@mozilla.com>"]
|
|||
description = "FFI bindings to libudev"
|
||||
|
||||
[dependencies]
|
||||
lazy_static = "0.2"
|
||||
lazy_static = "1.0"
|
||||
libc = "0.2"
|
||||
|
|
|
@ -43,7 +43,7 @@ nonzero = []
|
|||
path = "../src"
|
||||
|
||||
[dependencies]
|
||||
lazy_static = "0.2.1"
|
||||
lazy_static = "1.0"
|
||||
libc = "0.2"
|
||||
log = "0.3"
|
||||
num-traits = "0.1.32"
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{".travis.yml":"d84605e26d95fabc8172af7a621d3e48117b5180d389c6a166d15acb09c9ed9f","CHANGELOG.md":"5e62172f395348eb92a3fd2532ba5d65a7f13286449a3698b41f3aac7a9a4e57","Cargo.toml":"4406898417f3336a7f285eb59ca78efa43e228e64215403cd82974ce61d86d60","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0621878e61f0d0fda054bcbe02df75192c28bde1ecc8289cbd86aeba2dd72720","README.md":"8728114db9ab19bca8e07b36f1cccd1e6a57db6ea03be08679aef2a982736532","benches/defer.rs":"b2b64a8bb684721f12432aa63ae1e2227511879567ed212c0430961805b9f543","benches/flush.rs":"3b8c6be173ea546ad7e93adff324244a1c289608403bb13cc3bd89082fe90e35","benches/pin.rs":"4165baf238bbe2267e1598695d41ea8d3a312aa613d567e4dd7f5581a0f1323c","examples/sanitize.rs":"41b2d03e2cfd46912a3722295843b841e74e10eae6eb23586d3bc3b6d0a41e32","src/atomic.rs":"469ae38d3e8b37eec79c1c21a29a63cd357e49f34f4b6cdde6817f8e1267bd8d","src/collector.rs":"ebebbf1229a0d5339b938825d0dca9dc8642f9fa5bbceafb4e371477186ed4b4","src/default.rs":"804c217df80e0b6df3c6e90c5d6f5153c153567ac28cc75cc62042ba75d24bf2","src/deferred.rs":"1bd6c66c58f92714088b6f9f811368a123143a5f03cf4afc4b19ab24f3181387","src/epoch.rs":"25b85734a4ec5bedb0384a1fe976ec97056a88910a046a270a3e38558f7dbd4b","src/garbage.rs":"b77a8f87701dca8b63d858bb234137335455b6fc1f223e73c7609542d13daa43","src/guard.rs":"08975d989ba558aba90d64865594b155b2135e628414f77bb8afb9de427a2e0d","src/internal.rs":"a5a6a52999ce99294d544ac7cb82cb820e78f0c41315fc8d7494d21ca6da1135","src/lib.rs":"f3093bc3411f2bd94d662c3cf8719411b62793449b3db1699865f4c08c207af1","src/sync/list.rs":"57c3674c40e30eaf92689ab0e09973d7d161e52a5bdb5b5481b62fd0d10fb4eb","src/sync/mod.rs":"2da979ca3a2293f7626a2e6a9ab2fad758d92e3d2bed6cc712ef59eeeea87eab","src/sync/queue.rs":"868b5bd651e54216fa1827d668ab564c120779113ae7a2a056fee4371db1066c"},"package":"59796cc6cbbdc6bb319161349db0c3250ec73ec7fcb763a51065ec4e2e158552"}
|
||||
{"files":{".travis.yml":"d84605e26d95fabc8172af7a621d3e48117b5180d389c6a166d15acb09c9ed9f","CHANGELOG.md":"5e62172f395348eb92a3fd2532ba5d65a7f13286449a3698b41f3aac7a9a4e57","Cargo.toml":"6bcfcac3b6b20026d1020890fcd8cd5f6ceff33741b92fea001993696e2aed17","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0621878e61f0d0fda054bcbe02df75192c28bde1ecc8289cbd86aeba2dd72720","README.md":"8728114db9ab19bca8e07b36f1cccd1e6a57db6ea03be08679aef2a982736532","benches/defer.rs":"b2b64a8bb684721f12432aa63ae1e2227511879567ed212c0430961805b9f543","benches/flush.rs":"3b8c6be173ea546ad7e93adff324244a1c289608403bb13cc3bd89082fe90e35","benches/pin.rs":"4165baf238bbe2267e1598695d41ea8d3a312aa613d567e4dd7f5581a0f1323c","examples/sanitize.rs":"41b2d03e2cfd46912a3722295843b841e74e10eae6eb23586d3bc3b6d0a41e32","src/atomic.rs":"469ae38d3e8b37eec79c1c21a29a63cd357e49f34f4b6cdde6817f8e1267bd8d","src/collector.rs":"ebebbf1229a0d5339b938825d0dca9dc8642f9fa5bbceafb4e371477186ed4b4","src/default.rs":"804c217df80e0b6df3c6e90c5d6f5153c153567ac28cc75cc62042ba75d24bf2","src/deferred.rs":"1bd6c66c58f92714088b6f9f811368a123143a5f03cf4afc4b19ab24f3181387","src/epoch.rs":"25b85734a4ec5bedb0384a1fe976ec97056a88910a046a270a3e38558f7dbd4b","src/garbage.rs":"b77a8f87701dca8b63d858bb234137335455b6fc1f223e73c7609542d13daa43","src/guard.rs":"08975d989ba558aba90d64865594b155b2135e628414f77bb8afb9de427a2e0d","src/internal.rs":"a5a6a52999ce99294d544ac7cb82cb820e78f0c41315fc8d7494d21ca6da1135","src/lib.rs":"f3093bc3411f2bd94d662c3cf8719411b62793449b3db1699865f4c08c207af1","src/sync/list.rs":"57c3674c40e30eaf92689ab0e09973d7d161e52a5bdb5b5481b62fd0d10fb4eb","src/sync/mod.rs":"2da979ca3a2293f7626a2e6a9ab2fad758d92e3d2bed6cc712ef59eeeea87eab","src/sync/queue.rs":"868b5bd651e54216fa1827d668ab564c120779113ae7a2a056fee4371db1066c"},"package":"927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150"}
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
[package]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
authors = ["The Crossbeam Project Developers"]
|
||||
description = "Epoch-based garbage collection"
|
||||
homepage = "https://github.com/crossbeam-rs/crossbeam-epoch"
|
||||
|
@ -34,7 +34,7 @@ version = "0.2"
|
|||
default-features = false
|
||||
|
||||
[dependencies.lazy_static]
|
||||
version = "0.2"
|
||||
version = "1.0.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.memoffset]
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"0b4c8dcf0a46bb7a21d3872485dce2bd0a91fa3003b1a87ecee8e418a95b5f94","README.md":"d69d75705e2582721cbfb2d3b4b2af052c71679057a0b2ac53a22c03f1755bba","appveyor.yml":"2c7b2468dc69bef84860b8900024cb6e1a1c52f6fe1232e8ccd83caaf7c231ca","src/bitmap_render_target.rs":"d3b229f85a9804ac52976431657727b410e7d5253283df046e46d98c196f0a3a","src/com_helpers.rs":"fccb4b36379ae3454a88aa32a8e5c09e46ef5f5626266dde1fe5f40a992de39c","src/comptr.rs":"218435689f505769686e07cfc5428852dda90b849a0d48e670f632307f5edc7c","src/font.rs":"9bdf3134c6ad3639eab3da4419c9b43aad2673797f6fdc65841da2c82e1f3af4","src/font_collection.rs":"969fa3abf141dc3504774886f4783fda4a74cd5a198c643f8a77fc1af4e75258","src/font_face.rs":"97bb3f67516b766fb3522f6fb07836cd55020adecc814353d2da35f885c66a85","src/font_family.rs":"403da9f8f9903cbe7f9f79636497b273f9885e200f53af99f9d4e483f11d6889","src/font_file.rs":"60ad02fc25765a2c113175ea372e98a2be0d84aa65fef9246b6a0192e63ff708","src/font_file_loader_impl.rs":"0d304ad99ff1e6874510a1498223329d798ff75b417e3db7e823a695003dfe92","src/gdi_interop.rs":"98922996afc5b8c8304cb65e7c965419003825dfa172a3e11fe69bf3d768551c","src/glyph_run_analysis.rs":"d30d8b41b047815ab5770c730b7a6d09939f2347b4a4257b87bebec08a5794fe","src/helpers.rs":"5d6f164468234ca8806dc1cea117b42dbfae80cc4c9ae965cb0556efdb364682","src/lib.rs":"af8bae7d775a9ddeb956353e572b553aa2819f7183bb3aed8dde98016f6b4c97","src/rendering_params.rs":"be1d1c433f76926c285d8ecdb747c5d9cc6a6c10c1a1890c0760cd99755ed471","src/test.rs":"d77e45f8866abeea070cbbafd4cbde62d875292e8d191310a04c70091978547c","src/types.rs":"784235c15d61fb0d001373575169aa473c92af18dcbc1709a5b2bbaa3a7ceb22"},"package":"a207eb7b40e25d1d28dc679f451d321fb6954b73ceaa47986702575865469461"}
|
||||
{"files":{"Cargo.toml":"5fe56546432c0adb817b352c979eb7285d3c03d30dd9dc211449a6bbe3cb175e","README.md":"d69d75705e2582721cbfb2d3b4b2af052c71679057a0b2ac53a22c03f1755bba","appveyor.yml":"2c7b2468dc69bef84860b8900024cb6e1a1c52f6fe1232e8ccd83caaf7c231ca","src/bitmap_render_target.rs":"d3b229f85a9804ac52976431657727b410e7d5253283df046e46d98c196f0a3a","src/com_helpers.rs":"fccb4b36379ae3454a88aa32a8e5c09e46ef5f5626266dde1fe5f40a992de39c","src/comptr.rs":"218435689f505769686e07cfc5428852dda90b849a0d48e670f632307f5edc7c","src/font.rs":"9bdf3134c6ad3639eab3da4419c9b43aad2673797f6fdc65841da2c82e1f3af4","src/font_collection.rs":"969fa3abf141dc3504774886f4783fda4a74cd5a198c643f8a77fc1af4e75258","src/font_face.rs":"97bb3f67516b766fb3522f6fb07836cd55020adecc814353d2da35f885c66a85","src/font_family.rs":"403da9f8f9903cbe7f9f79636497b273f9885e200f53af99f9d4e483f11d6889","src/font_file.rs":"60ad02fc25765a2c113175ea372e98a2be0d84aa65fef9246b6a0192e63ff708","src/font_file_loader_impl.rs":"0d304ad99ff1e6874510a1498223329d798ff75b417e3db7e823a695003dfe92","src/gdi_interop.rs":"98922996afc5b8c8304cb65e7c965419003825dfa172a3e11fe69bf3d768551c","src/glyph_run_analysis.rs":"d30d8b41b047815ab5770c730b7a6d09939f2347b4a4257b87bebec08a5794fe","src/helpers.rs":"5d6f164468234ca8806dc1cea117b42dbfae80cc4c9ae965cb0556efdb364682","src/lib.rs":"af8bae7d775a9ddeb956353e572b553aa2819f7183bb3aed8dde98016f6b4c97","src/rendering_params.rs":"be1d1c433f76926c285d8ecdb747c5d9cc6a6c10c1a1890c0760cd99755ed471","src/test.rs":"d77e45f8866abeea070cbbafd4cbde62d875292e8d191310a04c70091978547c","src/types.rs":"784235c15d61fb0d001373575169aa473c92af18dcbc1709a5b2bbaa3a7ceb22"},"package":"b26e30aaa6bf31ec830db15fec14ed04f0f2ecfcc486ecfce88c55d3389b237f"}
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
[package]
|
||||
name = "dwrote"
|
||||
version = "0.4.1"
|
||||
version = "0.4.2"
|
||||
authors = ["Vladimir Vukicevic <vladimir@pobox.com>"]
|
||||
description = "Lightweight binding to DirectWrite."
|
||||
license = "MPL-2.0"
|
||||
|
@ -20,23 +20,23 @@ repository = "https://github.com/servo/dwrote-rs"
|
|||
|
||||
[lib]
|
||||
name = "dwrote"
|
||||
[dependencies.gdi32-sys]
|
||||
version = "0.2"
|
||||
|
||||
[dependencies.kernel32-sys]
|
||||
version = "0.2"
|
||||
|
||||
[dependencies.lazy_static]
|
||||
version = "1"
|
||||
|
||||
[dependencies.libc]
|
||||
version = "0.2"
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1.0"
|
||||
|
||||
[dependencies.serde_derive]
|
||||
version = "1.0"
|
||||
|
||||
[dependencies.winapi]
|
||||
version = "0.2"
|
||||
|
||||
[dependencies.gdi32-sys]
|
||||
version = "0.2"
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1.0"
|
||||
|
||||
[dependencies.libc]
|
||||
version = "0.2"
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
{"files":{".travis.yml":"a1cad0121fd4c6507c8b709fee344367ea73eff40915c2fd6a6108762c84f8f2","Cargo.toml":"b598bd90e0cda5d1d3cec4042310a9e74afbe398a76af48e0d43ea5d3c51f137","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0621878e61f0d0fda054bcbe02df75192c28bde1ecc8289cbd86aeba2dd72720","README.md":"c305f498e6d89730d84eaf92e980ba001e259dd40fcb40855947baece2af0895","appveyor.yml":"68c8ff7090ffdfa42b3d65b841d5de67d47a2206e02bf97aaca34b4500ae4bf1","src/core_lazy.rs":"2cea85ad0c2c4f88a5a927815a59270411daa4075510fad0faf671d5f5130fed","src/lazy.rs":"52912a897e8fcc95672e3b3068be82d56548f422edcb60e6ce9570779acb5bc0","src/lib.rs":"facd354cb716ee6941bf9bc8d34c27a2ecd752746c4d5164dbec8cedd80df605","src/nightly_lazy.rs":"34080822b27f3968c872867131448df76acc5aeff259852ff86f6e73b5a913b6","tests/compile-fail/README.md":"296216a459b7bf9947ba540c94b71a48ec90c2632ef5f05248a01dc8611ae149","tests/compile-fail/incorrect_visibility_restriction.rs":"557c94f781d6a2fb6c4be32a2ea252752195ff7b7c889581d95c39f2ce45e7d3","tests/compile-fail/static_is_private.rs":"f778f0759529b2dc8360f9abad1e09ea6662493493d707b3fba6cb1cb3d94af2","tests/compile-fail/static_is_sized.rs":"3b6d632f764ccee5fbd413324d7daeb2ab52dec0c99ea1db11a7eb2bbcad37cb","tests/compile-fail/static_never_used.rs":"5139e2459b4c68b0ed3f5a04452f60895b076acb1b5f344fb6b8ccbd50283a2d","tests/compile_tests.rs":"5710b2c0edc7623b895d67c26180a6c1d4022c154ecd616fab449afc9ba95109","tests/no_std.rs":"2a5236bd3892a253855b4dc192f63138239165fa23b9c3421a9faa5482c780aa","tests/test.rs":"12b100f4790037ca049692d896114d6361373c5321c29e0032c290ee39f1042c"},"package":"76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"}
|
|
@ -1,31 +0,0 @@
|
|||
language: rust
|
||||
rust:
|
||||
- nightly
|
||||
- beta
|
||||
- stable
|
||||
before_script:
|
||||
- |
|
||||
pip install 'travis-cargo<0.2' --user &&
|
||||
export PATH=`python -m site --user-base`/bin:$PATH
|
||||
script:
|
||||
- |
|
||||
travis-cargo build &&
|
||||
travis-cargo test &&
|
||||
travis-cargo bench &&
|
||||
travis-cargo --only nightly build -- --features spin_no_std &&
|
||||
travis-cargo --only nightly test -- --features spin_no_std &&
|
||||
travis-cargo --only nightly bench -- --features spin_no_std &&
|
||||
travis-cargo --only nightly clean &&
|
||||
travis-cargo --only nightly build -- --features compiletest &&
|
||||
travis-cargo --only nightly test -- --features compiletest &&
|
||||
travis-cargo --only nightly clean &&
|
||||
travis-cargo --only stable doc
|
||||
after_success:
|
||||
- travis-cargo --only stable doc-upload
|
||||
env:
|
||||
global:
|
||||
- TRAVIS_CARGO_NIGHTLY_FEATURE=nightly
|
||||
- secure: YXu24LptjeYirjWYjWGsMT2m3mB7LvQATE6TVo7VEUXv8GYoy2ORIHD83PeImxC93MmZ01QeUezRzuCW51ZcK92VnNSBttlF60SvIX18VsJrV92tsAhievFstqYQ+fB8DIuQ8noU0jPz7GpI+R9dlTRSImAqWOnVIghA+Wzz7Js=
|
||||
os:
|
||||
- linux
|
||||
- osx
|
|
@ -1,43 +0,0 @@
|
|||
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||
#
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g. crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
# editing this file be aware that the upstream Cargo.toml
|
||||
# will likely look very different (and much more reasonable)
|
||||
|
||||
[package]
|
||||
name = "lazy_static"
|
||||
version = "0.2.11"
|
||||
authors = ["Marvin Löbel <loebel.marvin@gmail.com>"]
|
||||
description = "A macro for declaring lazily evaluated statics in Rust."
|
||||
documentation = "https://docs.rs/lazy_static"
|
||||
readme = "README.md"
|
||||
keywords = ["macro", "lazy", "static"]
|
||||
categories = ["no-std", "rust-patterns", "memory-management"]
|
||||
license = "MIT/Apache-2.0"
|
||||
repository = "https://github.com/rust-lang-nursery/lazy-static.rs"
|
||||
[dependencies.compiletest_rs]
|
||||
version = "0.3"
|
||||
optional = true
|
||||
|
||||
[dependencies.spin]
|
||||
version = "0.4.6"
|
||||
optional = true
|
||||
|
||||
[features]
|
||||
compiletest = ["compiletest_rs"]
|
||||
nightly = []
|
||||
spin_no_std = ["nightly", "spin"]
|
||||
[badges.appveyor]
|
||||
repository = "rust-lang-nursery/lazy-static.rs"
|
||||
|
||||
[badges.maintenance]
|
||||
status = "passively-maintained"
|
||||
|
||||
[badges.travis-ci]
|
||||
repository = "rust-lang-nursery/lazy-static.rs"
|
|
@ -1,201 +0,0 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -1,25 +0,0 @@
|
|||
Copyright (c) 2010 The Rust Project Developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
|
@ -1,69 +0,0 @@
|
|||
lazy-static.rs
|
||||
==============
|
||||
|
||||
A macro for declaring lazily evaluated statics in Rust.
|
||||
|
||||
Using this macro, it is possible to have `static`s that require code to be
|
||||
executed at runtime in order to be initialized.
|
||||
This includes anything requiring heap allocations, like vectors or hash maps,
|
||||
as well as anything that requires non-const function calls to be computed.
|
||||
|
||||
[![Travis-CI Status](https://travis-ci.org/rust-lang-nursery/lazy-static.rs.svg?branch=master)](https://travis-ci.org/rust-lang-nursery/lazy-static.rs)
|
||||
|
||||
# Getting Started
|
||||
|
||||
[lazy-static.rs is available on crates.io](https://crates.io/crates/lazy_static).
|
||||
It is recommended to look there for the newest released version, as well as links to the newest builds of the docs.
|
||||
|
||||
At the point of the last update of this README, the latest published version could be used like this:
|
||||
|
||||
Add the following dependency to your Cargo manifest...
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
lazy_static = "0.2"
|
||||
```
|
||||
|
||||
...and see the [docs](https://docs.rs/lazy_static) for how to use it.
|
||||
|
||||
# Example
|
||||
|
||||
```rust
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
lazy_static! {
|
||||
static ref HASHMAP: HashMap<u32, &'static str> = {
|
||||
let mut m = HashMap::new();
|
||||
m.insert(0, "foo");
|
||||
m.insert(1, "bar");
|
||||
m.insert(2, "baz");
|
||||
m
|
||||
};
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// First access to `HASHMAP` initializes it
|
||||
println!("The entry for `0` is \"{}\".", HASHMAP.get(&0).unwrap());
|
||||
|
||||
// Any further access to `HASHMAP` just returns the computed value
|
||||
println!("The entry for `1` is \"{}\".", HASHMAP.get(&1).unwrap());
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Licensed under either of
|
||||
|
||||
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||
|
||||
at your option.
|
||||
|
||||
### Contribution
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted
|
||||
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
|
||||
additional terms or conditions.
|
|
@ -1,59 +0,0 @@
|
|||
environment:
|
||||
global:
|
||||
PROJECT_NAME: lazy_static
|
||||
# When this was added there were revocation check failures when using the
|
||||
# libcurl backend as libcurl checks by default, but rustup doesn't provide the
|
||||
# switch to turn this off. Switch to Hyper which looks to not check for
|
||||
# revocation by default like libcurl does.
|
||||
RUSTUP_USE_REQWEST: 1
|
||||
CARGO_HTTP_CHECK_REVOKE: false
|
||||
matrix:
|
||||
# Stable channel
|
||||
- TARGET: i686-pc-windows-gnu
|
||||
CHANNEL: stable
|
||||
- TARGET: i686-pc-windows-msvc
|
||||
CHANNEL: stable
|
||||
- TARGET: x86_64-pc-windows-gnu
|
||||
CHANNEL: stable
|
||||
- TARGET: x86_64-pc-windows-msvc
|
||||
CHANNEL: stable
|
||||
# Beta channel
|
||||
- TARGET: i686-pc-windows-gnu
|
||||
CHANNEL: beta
|
||||
- TARGET: i686-pc-windows-msvc
|
||||
CHANNEL: beta
|
||||
- TARGET: x86_64-pc-windows-gnu
|
||||
CHANNEL: beta
|
||||
- TARGET: x86_64-pc-windows-msvc
|
||||
CHANNEL: beta
|
||||
# Nightly channel
|
||||
- TARGET: i686-pc-windows-gnu
|
||||
CHANNEL: nightly
|
||||
- TARGET: i686-pc-windows-msvc
|
||||
CHANNEL: nightly
|
||||
- TARGET: x86_64-pc-windows-gnu
|
||||
CHANNEL: nightly
|
||||
- TARGET: x86_64-pc-windows-msvc
|
||||
CHANNEL: nightly
|
||||
|
||||
# Install Rust and Cargo
|
||||
# (Based on from https://github.com/rust-lang/libc/blob/master/appveyor.yml)
|
||||
install:
|
||||
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
|
||||
- rustup-init.exe -y --default-toolchain %CHANNEL% --default-host %TARGET%
|
||||
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
|
||||
- if "%TARGET%" == "i686-pc-windows-gnu" set PATH=%PATH%;C:\msys64\mingw32\bin
|
||||
- if "%TARGET%" == "x86_64-pc-windows-gnu" set PATH=%PATH%;C:\msys64\mingw64\bin
|
||||
- rustc -V
|
||||
- cargo -V
|
||||
|
||||
build: false
|
||||
|
||||
test_script:
|
||||
- cargo build --verbose
|
||||
- cargo test
|
||||
- if [%CHANNEL%]==[nightly] (
|
||||
cargo clean &&
|
||||
cargo build --verbose --features "compiletest" &&
|
||||
cargo test --features "compiletest"
|
||||
)
|
|
@ -1,33 +0,0 @@
|
|||
// Copyright 2016 lazy-static.rs Developers
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
|
||||
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
|
||||
// http://opensource.org/licenses/MIT>, at your option. This file may not be
|
||||
// copied, modified, or distributed except according to those terms.
|
||||
|
||||
extern crate spin;
|
||||
|
||||
use self::spin::Once;
|
||||
|
||||
pub struct Lazy<T: Sync>(Once<T>);
|
||||
|
||||
impl<T: Sync> Lazy<T> {
|
||||
#[inline(always)]
|
||||
pub const fn new() -> Self {
|
||||
Lazy(Once::new())
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn get<F>(&'static self, builder: F) -> &T
|
||||
where F: FnOnce() -> T
|
||||
{
|
||||
self.0.call_once(builder)
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! __lazy_static_create {
|
||||
($NAME:ident, $T:ty) => {
|
||||
static $NAME: $crate::lazy::Lazy<$T> = $crate::lazy::Lazy::new();
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
// Copyright 2016 lazy-static.rs Developers
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
|
||||
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
|
||||
// http://opensource.org/licenses/MIT>, at your option. This file may not be
|
||||
// copied, modified, or distributed except according to those terms.
|
||||
|
||||
extern crate std;
|
||||
|
||||
use self::std::prelude::v1::*;
|
||||
use self::std::sync::Once;
|
||||
pub use self::std::sync::ONCE_INIT;
|
||||
|
||||
pub struct Lazy<T: Sync>(pub *const T, pub Once);
|
||||
|
||||
impl<T: Sync> Lazy<T> {
|
||||
#[inline(always)]
|
||||
pub fn get<F>(&'static mut self, f: F) -> &T
|
||||
where F: FnOnce() -> T
|
||||
{
|
||||
unsafe {
|
||||
let r = &mut self.0;
|
||||
self.1.call_once(|| {
|
||||
*r = Box::into_raw(Box::new(f()));
|
||||
});
|
||||
|
||||
&*self.0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl<T: Sync> Sync for Lazy<T> {}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! __lazy_static_create {
|
||||
($NAME:ident, $T:ty) => {
|
||||
static mut $NAME: $crate::lazy::Lazy<$T> = $crate::lazy::Lazy(0 as *const $T, $crate::lazy::ONCE_INIT);
|
||||
}
|
||||
}
|
|
@ -1,212 +0,0 @@
|
|||
// Copyright 2016 lazy-static.rs Developers
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
|
||||
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
|
||||
// http://opensource.org/licenses/MIT>, at your option. This file may not be
|
||||
// copied, modified, or distributed except according to those terms.
|
||||
|
||||
/*!
|
||||
A macro for declaring lazily evaluated statics.
|
||||
|
||||
Using this macro, it is possible to have `static`s that require code to be
|
||||
executed at runtime in order to be initialized.
|
||||
This includes anything requiring heap allocations, like vectors or hash maps,
|
||||
as well as anything that requires function calls to be computed.
|
||||
|
||||
# Syntax
|
||||
|
||||
```ignore
|
||||
lazy_static! {
|
||||
[pub] static ref NAME_1: TYPE_1 = EXPR_1;
|
||||
[pub] static ref NAME_2: TYPE_2 = EXPR_2;
|
||||
...
|
||||
[pub] static ref NAME_N: TYPE_N = EXPR_N;
|
||||
}
|
||||
```
|
||||
|
||||
Attributes (including doc comments) are supported as well:
|
||||
|
||||
```rust
|
||||
# #[macro_use]
|
||||
# extern crate lazy_static;
|
||||
# fn main() {
|
||||
lazy_static! {
|
||||
/// This is an example for using doc comment attributes
|
||||
static ref EXAMPLE: u8 = 42;
|
||||
}
|
||||
# }
|
||||
```
|
||||
|
||||
# Semantics
|
||||
|
||||
For a given `static ref NAME: TYPE = EXPR;`, the macro generates a unique type that
|
||||
implements `Deref<TYPE>` and stores it in a static with name `NAME`. (Attributes end up
|
||||
attaching to this type.)
|
||||
|
||||
On first deref, `EXPR` gets evaluated and stored internally, such that all further derefs
|
||||
can return a reference to the same object. Note that this can lead to deadlocks
|
||||
if you have multiple lazy statics that depend on each other in their initialization.
|
||||
|
||||
Apart from the lazy initialization, the resulting "static ref" variables
|
||||
have generally the same properties as regular "static" variables:
|
||||
|
||||
- Any type in them needs to fulfill the `Sync` trait.
|
||||
- If the type has a destructor, then it will not run when the process exits.
|
||||
|
||||
# Example
|
||||
|
||||
Using the macro:
|
||||
|
||||
```rust
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
lazy_static! {
|
||||
static ref HASHMAP: HashMap<u32, &'static str> = {
|
||||
let mut m = HashMap::new();
|
||||
m.insert(0, "foo");
|
||||
m.insert(1, "bar");
|
||||
m.insert(2, "baz");
|
||||
m
|
||||
};
|
||||
static ref COUNT: usize = HASHMAP.len();
|
||||
static ref NUMBER: u32 = times_two(21);
|
||||
}
|
||||
|
||||
fn times_two(n: u32) -> u32 { n * 2 }
|
||||
|
||||
fn main() {
|
||||
println!("The map has {} entries.", *COUNT);
|
||||
println!("The entry for `0` is \"{}\".", HASHMAP.get(&0).unwrap());
|
||||
println!("A expensive calculation on a static results in: {}.", *NUMBER);
|
||||
}
|
||||
```
|
||||
|
||||
# Implementation details
|
||||
|
||||
The `Deref` implementation uses a hidden static variable that is guarded by a atomic check on each access. On stable Rust, the macro may need to allocate each static on the heap.
|
||||
|
||||
*/
|
||||
|
||||
#![cfg_attr(feature="spin_no_std", feature(const_fn))]
|
||||
#![cfg_attr(feature="nightly", feature(unreachable))]
|
||||
|
||||
#![doc(html_root_url = "https://docs.rs/lazy_static/0.2.11")]
|
||||
#![no_std]
|
||||
|
||||
#[cfg(not(feature="nightly"))]
|
||||
#[doc(hidden)]
|
||||
pub mod lazy;
|
||||
|
||||
#[cfg(all(feature="nightly", not(feature="spin_no_std")))]
|
||||
#[path="nightly_lazy.rs"]
|
||||
#[doc(hidden)]
|
||||
pub mod lazy;
|
||||
|
||||
#[cfg(all(feature="nightly", feature="spin_no_std"))]
|
||||
#[path="core_lazy.rs"]
|
||||
#[doc(hidden)]
|
||||
pub mod lazy;
|
||||
|
||||
#[doc(hidden)]
|
||||
pub use core::ops::Deref as __Deref;
|
||||
|
||||
#[macro_export]
|
||||
#[doc(hidden)]
|
||||
macro_rules! __lazy_static_internal {
|
||||
// optional visibility restrictions are wrapped in `()` to allow for
|
||||
// explicitly passing otherwise implicit information about private items
|
||||
($(#[$attr:meta])* ($($vis:tt)*) static ref $N:ident : $T:ty = $e:expr; $($t:tt)*) => {
|
||||
__lazy_static_internal!(@MAKE TY, $(#[$attr])*, ($($vis)*), $N);
|
||||
__lazy_static_internal!(@TAIL, $N : $T = $e);
|
||||
lazy_static!($($t)*);
|
||||
};
|
||||
(@TAIL, $N:ident : $T:ty = $e:expr) => {
|
||||
impl $crate::__Deref for $N {
|
||||
type Target = $T;
|
||||
#[allow(unsafe_code)]
|
||||
fn deref(&self) -> &$T {
|
||||
unsafe {
|
||||
#[inline(always)]
|
||||
fn __static_ref_initialize() -> $T { $e }
|
||||
|
||||
#[inline(always)]
|
||||
unsafe fn __stability() -> &'static $T {
|
||||
__lazy_static_create!(LAZY, $T);
|
||||
LAZY.get(__static_ref_initialize)
|
||||
}
|
||||
__stability()
|
||||
}
|
||||
}
|
||||
}
|
||||
impl $crate::LazyStatic for $N {
|
||||
fn initialize(lazy: &Self) {
|
||||
let _ = &**lazy;
|
||||
}
|
||||
}
|
||||
};
|
||||
// `vis` is wrapped in `()` to prevent parsing ambiguity
|
||||
(@MAKE TY, $(#[$attr:meta])*, ($($vis:tt)*), $N:ident) => {
|
||||
#[allow(missing_copy_implementations)]
|
||||
#[allow(non_camel_case_types)]
|
||||
#[allow(dead_code)]
|
||||
$(#[$attr])*
|
||||
$($vis)* struct $N {__private_field: ()}
|
||||
#[doc(hidden)]
|
||||
$($vis)* static $N: $N = $N {__private_field: ()};
|
||||
};
|
||||
() => ()
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! lazy_static {
|
||||
($(#[$attr:meta])* static ref $N:ident : $T:ty = $e:expr; $($t:tt)*) => {
|
||||
// use `()` to explicitly forward the information about private items
|
||||
__lazy_static_internal!($(#[$attr])* () static ref $N : $T = $e; $($t)*);
|
||||
};
|
||||
($(#[$attr:meta])* pub static ref $N:ident : $T:ty = $e:expr; $($t:tt)*) => {
|
||||
__lazy_static_internal!($(#[$attr])* (pub) static ref $N : $T = $e; $($t)*);
|
||||
};
|
||||
($(#[$attr:meta])* pub ($($vis:tt)+) static ref $N:ident : $T:ty = $e:expr; $($t:tt)*) => {
|
||||
__lazy_static_internal!($(#[$attr])* (pub ($($vis)+)) static ref $N : $T = $e; $($t)*);
|
||||
};
|
||||
() => ()
|
||||
}
|
||||
|
||||
/// Support trait for enabling a few common operation on lazy static values.
|
||||
///
|
||||
/// This is implemented by each defined lazy static, and
|
||||
/// used by the free functions in this crate.
|
||||
pub trait LazyStatic {
|
||||
#[doc(hidden)]
|
||||
fn initialize(lazy: &Self);
|
||||
}
|
||||
|
||||
/// Takes a shared reference to a lazy static and initializes
|
||||
/// it if it has not been already.
|
||||
///
|
||||
/// This can be used to control the initialization point of a lazy static.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// ```rust
|
||||
/// #[macro_use]
|
||||
/// extern crate lazy_static;
|
||||
///
|
||||
/// lazy_static! {
|
||||
/// static ref BUFFER: Vec<u8> = (0..65537).collect();
|
||||
/// }
|
||||
///
|
||||
/// fn main() {
|
||||
/// lazy_static::initialize(&BUFFER);
|
||||
///
|
||||
/// // ...
|
||||
/// work_with_initialized_data(&BUFFER);
|
||||
/// }
|
||||
/// # fn work_with_initialized_data(_: &[u8]) {}
|
||||
/// ```
|
||||
pub fn initialize<T: LazyStatic>(lazy: &T) {
|
||||
LazyStatic::initialize(lazy);
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
// Copyright 2016 lazy-static.rs Developers
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
|
||||
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
|
||||
// http://opensource.org/licenses/MIT>, at your option. This file may not be
|
||||
// copied, modified, or distributed except according to those terms.
|
||||
|
||||
extern crate std;
|
||||
|
||||
use self::std::prelude::v1::*;
|
||||
use self::std::sync::Once;
|
||||
pub use self::std::sync::ONCE_INIT;
|
||||
|
||||
pub struct Lazy<T: Sync>(pub Option<T>, pub Once);
|
||||
|
||||
impl<T: Sync> Lazy<T> {
|
||||
#[inline(always)]
|
||||
pub fn get<F>(&'static mut self, f: F) -> &T
|
||||
where F: FnOnce() -> T
|
||||
{
|
||||
{
|
||||
let r = &mut self.0;
|
||||
self.1.call_once(|| {
|
||||
*r = Some(f());
|
||||
});
|
||||
}
|
||||
unsafe {
|
||||
match self.0 {
|
||||
Some(ref x) => x,
|
||||
None => std::mem::unreachable(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl<T: Sync> Sync for Lazy<T> {}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! __lazy_static_create {
|
||||
($NAME:ident, $T:ty) => {
|
||||
static mut $NAME: $crate::lazy::Lazy<$T> = $crate::lazy::Lazy(None, $crate::lazy::ONCE_INIT);
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
This directory contains snippets of code that should yield a
|
||||
warning/note/help/error at compilation. Syntax of annotations is described in
|
||||
[rust documentation](https://github.com/rust-lang/rust/blob/master/src/test/COMPILER_TESTS.md).
|
||||
For more information check out [`compiletest` crate](https://github.com/laumann/compiletest-rs).
|
||||
|
||||
To run compile tests issue `cargo +nightly --test --features compiletest`.
|
||||
|
||||
## Notes on working with `compiletest` crate
|
||||
|
||||
* Currently code that is inside macro should not be annotated, as `compiletest`
|
||||
crate cannot deal with the fact that macro invocations effectively changes
|
||||
line numbering. To prevent this add a `// error-pattern:<your error message here>`
|
||||
on the top of the file and make sure that you set `deny` lint level
|
||||
if you want to test compiler message different than error.
|
||||
* `compiletest` crate by default sets `allow(dead_code)` lint level so make sure
|
||||
that you change it to something suiting your needs even if the warning is
|
||||
issued prior to any macro invocation.
|
||||
* If you get a message `error: 0 unexpected errors found, 1 expected errors not found`
|
||||
despite the fact that some error was bound to occur don't worry - it's a known
|
||||
issue in the `compiletest` crate and your error was probably not registered -
|
||||
make sure that your annotations are correct and that you are setting correct
|
||||
lint levels.
|
|
@ -1,10 +0,0 @@
|
|||
// incorrect visibility restriction
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
lazy_static! {
|
||||
pub(nonsense) static ref WRONG: () = ();
|
||||
//~^ ERROR incorrect visibility restriction
|
||||
}
|
||||
|
||||
fn main() { }
|
|
@ -1,14 +0,0 @@
|
|||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
mod outer {
|
||||
pub mod inner {
|
||||
lazy_static! {
|
||||
pub(in outer) static ref FOO: () = ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
assert_eq!(*outer::inner::FOO, ()); //~ ERROR static `FOO` is private
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// error-pattern:the trait bound `str: std::marker::Sized` is not satisfied
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
lazy_static! {
|
||||
pub static ref FOO: str = panic!();
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
// error-pattern:static item is never used: `UNUSED`
|
||||
#![deny(dead_code)]
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
lazy_static! {
|
||||
static ref UNUSED: () = ();
|
||||
}
|
||||
|
||||
fn main() { }
|
|
@ -1,18 +0,0 @@
|
|||
#![cfg(feature="compiletest")]
|
||||
extern crate compiletest_rs as compiletest;
|
||||
|
||||
fn run_mode(mode: &'static str) {
|
||||
let mut config = compiletest::Config::default();
|
||||
config.mode = mode.parse().expect("Invalid mode");
|
||||
config.src_base = ["tests", mode].iter().collect();
|
||||
config.target_rustcflags = Some("-L target/debug/ -L target/debug/deps/".to_owned());
|
||||
|
||||
config.verbose = true;
|
||||
|
||||
compiletest::run_tests(&config);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn compile_test() {
|
||||
run_mode("compile-fail");
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
#![cfg(feature="spin_no_std")]
|
||||
#![feature(const_fn)]
|
||||
|
||||
#![no_std]
|
||||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
lazy_static! {
|
||||
/// Documentation!
|
||||
pub static ref NUMBER: u32 = times_two(3);
|
||||
}
|
||||
|
||||
fn times_two(n: u32) -> u32 {
|
||||
n * 2
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_basic() {
|
||||
assert_eq!(*NUMBER, 6);
|
||||
}
|
|
@ -1,164 +0,0 @@
|
|||
#![cfg_attr(feature="nightly", feature(const_fn))]
|
||||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
use std::collections::HashMap;
|
||||
|
||||
lazy_static! {
|
||||
/// Documentation!
|
||||
pub static ref NUMBER: u32 = times_two(3);
|
||||
|
||||
static ref ARRAY_BOXES: [Box<u32>; 3] = [Box::new(1), Box::new(2), Box::new(3)];
|
||||
|
||||
/// More documentation!
|
||||
#[allow(unused_variables)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub static ref STRING: String = "hello".to_string();
|
||||
|
||||
static ref HASHMAP: HashMap<u32, &'static str> = {
|
||||
let mut m = HashMap::new();
|
||||
m.insert(0, "abc");
|
||||
m.insert(1, "def");
|
||||
m.insert(2, "ghi");
|
||||
m
|
||||
};
|
||||
|
||||
// This should not compile if the unsafe is removed.
|
||||
static ref UNSAFE: u32 = unsafe {
|
||||
std::mem::transmute::<i32, u32>(-1)
|
||||
};
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref S1: &'static str = "a";
|
||||
static ref S2: &'static str = "b";
|
||||
}
|
||||
lazy_static! {
|
||||
static ref S3: String = [*S1, *S2].join("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn s3() {
|
||||
assert_eq!(&*S3, "ab");
|
||||
}
|
||||
|
||||
fn times_two(n: u32) -> u32 {
|
||||
n * 2
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_basic() {
|
||||
assert_eq!(&**STRING, "hello");
|
||||
assert_eq!(*NUMBER, 6);
|
||||
assert!(HASHMAP.get(&1).is_some());
|
||||
assert!(HASHMAP.get(&3).is_none());
|
||||
assert_eq!(&*ARRAY_BOXES, &[Box::new(1), Box::new(2), Box::new(3)]);
|
||||
assert_eq!(*UNSAFE, std::u32::MAX);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_repeat() {
|
||||
assert_eq!(*NUMBER, 6);
|
||||
assert_eq!(*NUMBER, 6);
|
||||
assert_eq!(*NUMBER, 6);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_meta() {
|
||||
// this would not compile if STRING were not marked #[derive(Copy, Clone)]
|
||||
let copy_of_string = STRING;
|
||||
// just to make sure it was copied
|
||||
assert!(&STRING as *const _ != ©_of_string as *const _);
|
||||
|
||||
// this would not compile if STRING were not marked #[derive(Debug)]
|
||||
assert_eq!(format!("{:?}", STRING), "STRING { __private_field: () }".to_string());
|
||||
}
|
||||
|
||||
mod visibility {
|
||||
lazy_static! {
|
||||
pub static ref FOO: Box<u32> = Box::new(0);
|
||||
static ref BAR: Box<u32> = Box::new(98);
|
||||
}
|
||||
|
||||
pub mod inner {
|
||||
lazy_static! {
|
||||
pub(in visibility) static ref BAZ: Box<u32> = Box::new(42);
|
||||
pub(crate) static ref BAG: Box<u32> = Box::new(37);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sub_test() {
|
||||
assert_eq!(**FOO, 0);
|
||||
assert_eq!(**BAR, 98);
|
||||
assert_eq!(**inner::BAZ, 42);
|
||||
assert_eq!(**inner::BAG, 37);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_visibility() {
|
||||
assert_eq!(*visibility::FOO, Box::new(0));
|
||||
assert_eq!(*visibility::inner::BAG, Box::new(37));
|
||||
}
|
||||
|
||||
// This should not cause a warning about a missing Copy implementation
|
||||
lazy_static! {
|
||||
pub static ref VAR: i32 = { 0 };
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
struct X;
|
||||
struct Once(X);
|
||||
const ONCE_INIT: Once = Once(X);
|
||||
static DATA: X = X;
|
||||
static ONCE: X = X;
|
||||
fn require_sync() -> X { X }
|
||||
fn transmute() -> X { X }
|
||||
fn __static_ref_initialize() -> X { X }
|
||||
fn test(_: Vec<X>) -> X { X }
|
||||
|
||||
// All these names should not be shadowed
|
||||
lazy_static! {
|
||||
static ref ITEM_NAME_TEST: X = {
|
||||
test(vec![X, Once(X).0, ONCE_INIT.0, DATA, ONCE,
|
||||
require_sync(), transmute(),
|
||||
// Except this, which will sadly be shadowed by internals:
|
||||
// __static_ref_initialize()
|
||||
])
|
||||
};
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn item_name_shadowing() {
|
||||
assert_eq!(*ITEM_NAME_TEST, X);
|
||||
}
|
||||
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::atomic::ATOMIC_BOOL_INIT;
|
||||
use std::sync::atomic::Ordering::SeqCst;
|
||||
|
||||
static PRE_INIT_FLAG: AtomicBool = ATOMIC_BOOL_INIT;
|
||||
|
||||
lazy_static! {
|
||||
static ref PRE_INIT: () = {
|
||||
PRE_INIT_FLAG.store(true, SeqCst);
|
||||
()
|
||||
};
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_init() {
|
||||
assert_eq!(PRE_INIT_FLAG.load(SeqCst), false);
|
||||
lazy_static::initialize(&PRE_INIT);
|
||||
assert_eq!(PRE_INIT_FLAG.load(SeqCst), true);
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref LIFETIME_NAME: for<'a> fn(&'a u8) = { fn f(_: &u8) {} f };
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lifetime_name() {
|
||||
let _ = LIFETIME_NAME;
|
||||
}
|
|
@ -1 +1 @@
|
|||
{"files":{".travis.yml":"c01fcdfc31a1092bfdbdd22a0d88773bdc280550b806ab2ebe23ac4b32d4a5c2","Cargo.toml":"cc42ea81b9749fdd354f433e91f845f656841e904b986ad08c30bf419a26c6d7","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","README.md":"00a29378d5aeb66b7a48b77bee0d463c8b408b8a9cb0abb7674edb10d142aca0","benches/thread_local.rs":"cc8bde81ed6206525feff209598caf1e01e89a83bf21d8b7ccc0dadc8b89d815","src/lib.rs":"e5902751bf1768fb756b88146da66a128920d3f1b166b797fd0a5e1528f2e687","src/thread_id.rs":"0962c130061939557aa272115e4420fbbc63b6bd306783a456a8ffcbf304a447"},"package":"1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14"}
|
||||
{"files":{".travis.yml":"c01fcdfc31a1092bfdbdd22a0d88773bdc280550b806ab2ebe23ac4b32d4a5c2","Cargo.toml":"a1b604dfa7a867267df097ac672afcceff2531c75e15982b7a3ecb3bf1604900","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","README.md":"00a29378d5aeb66b7a48b77bee0d463c8b408b8a9cb0abb7674edb10d142aca0","benches/thread_local.rs":"cc8bde81ed6206525feff209598caf1e01e89a83bf21d8b7ccc0dadc8b89d815","src/lib.rs":"e5902751bf1768fb756b88146da66a128920d3f1b166b797fd0a5e1528f2e687","src/thread_id.rs":"0962c130061939557aa272115e4420fbbc63b6bd306783a456a8ffcbf304a447"},"package":"279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963"}
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
[package]
|
||||
name = "thread_local"
|
||||
version = "0.3.4"
|
||||
version = "0.3.5"
|
||||
authors = ["Amanieu d'Antras <amanieu@gmail.com>"]
|
||||
description = "Per-object thread-local storage"
|
||||
documentation = "https://amanieu.github.io/thread_local-rs/thread_local/index.html"
|
||||
|
@ -20,8 +20,10 @@ readme = "README.md"
|
|||
keywords = ["thread_local", "concurrent", "thread"]
|
||||
license = "Apache-2.0/MIT"
|
||||
repository = "https://github.com/Amanieu/thread_local-rs"
|
||||
[dependencies.unreachable]
|
||||
[dependencies.lazy_static]
|
||||
version = "1.0"
|
||||
|
||||
[dependencies.lazy_static]
|
||||
version = "0.2"
|
||||
[dependencies.unreachable]
|
||||
version = "1.0"
|
||||
[badges.travis-ci]
|
||||
repository = "Amanieu/thread_local-rs"
|
||||
|
|
|
@ -9,4 +9,4 @@ proc-macro = true
|
|||
[dependencies]
|
||||
syn = "0.11"
|
||||
quote = "0.3"
|
||||
lazy_static = "0.2"
|
||||
lazy_static = "1.0"
|
||||
|
|
Загрузка…
Ссылка в новой задаче