diff options
| author | Thomas Bächler <thomas.baechler@gmx.de> | 2020-03-21 19:48:23 +0100 |
|---|---|---|
| committer | Thomas Bächler <thomas.baechler@gmx.de> | 2020-03-21 19:48:23 +0100 |
| commit | c8140a88f67cf1fea104b1aaa615af7816984615 (patch) | |
| tree | 04f0a756194d67eec457b152a67d33c3cb725db4 /src/libstd | |
| parent | 98803c182b2ba6ef5dccb6bf501958249295eac0 (diff) | |
| download | rust-c8140a88f67cf1fea104b1aaa615af7816984615.tar.gz rust-c8140a88f67cf1fea104b1aaa615af7816984615.zip | |
Return NonZeroU64 from ThreadId::as_u64.
As discussed in #67939, this allows turning Option<ThreadId> into Option<NonZeroU64> which can then be stored inside an AtomicU64.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/thread/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 0dc43c7e651..282e268efd2 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -1082,8 +1082,8 @@ impl ThreadId { /// it is not guaranteed which values new threads will return, and this may /// change across Rust versions. #[unstable(feature = "thread_id_value", issue = "67939")] - pub fn as_u64(&self) -> u64 { - self.0.get() + pub fn as_u64(&self) -> NonZeroU64 { + self.0 } } |
