diff --git a/src/handle.rs b/src/handle.rs index f2d395f..4551c05 100644 --- a/src/handle.rs +++ b/src/handle.rs @@ -1,7 +1,7 @@ use std::{ fmt::{Debug, Formatter}, marker::PhantomData, - sync::atomic::{AtomicU64, Ordering}, + sync::atomic::{AtomicUsize, Ordering}, }; pub trait Handle { @@ -10,16 +10,16 @@ pub trait Handle { #[derive(Clone, Copy, Eq, PartialEq, Hash)] pub struct RawHandle { - generator_id: u64, - handle_id: u64, + generator_id: usize, + handle_id: usize, } impl RawHandle { - pub fn generator_id(&self) -> u64 { + pub fn generator_id(&self) -> usize { self.generator_id } - pub fn handle_id(&self) -> u64 { + pub fn handle_id(&self) -> usize { self.handle_id } } @@ -28,8 +28,8 @@ pub struct HandleGenerator { /// This ID is used to bind the handles to the generator instance, i.e. it's possible to /// distinguish handles generated by different generators. We hope that this might /// prevent bugs when the library user is dealing with handles from different sources. - generator_id: u64, - next_handle_id: u64, + generator_id: usize, + next_handle_id: usize, _h: PhantomData, } @@ -55,14 +55,14 @@ impl HandleGenerator { } pub struct HandleGeneratorGenerator { - next_handle_generator_id: AtomicU64, + next_handle_generator_id: AtomicUsize, _h: PhantomData, } impl HandleGeneratorGenerator { pub const fn new() -> Self { Self { - next_handle_generator_id: AtomicU64::new(0), + next_handle_generator_id: AtomicUsize::new(0), _h: PhantomData, } }