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.
This commit is contained in:
Thomas Bächler 2020-03-21 19:48:23 +01:00
parent 98803c182b
commit c8140a88f6
2 changed files with 4 additions and 4 deletions

View file

@ -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
}
}