pub fn compare_update(&self, current: Option<RcuReference<'_, T>>, new: Option<Box<T>>) -> Result<RcuSyncHandle<T>, (Option<Box<T>>, Option<RcuReference<'_, T>>)> {
        let current_ptr = current.map_or(ptr::null(), RcuReference::into_inner) as *mut T;
        let new_ptr = option_box_to_ptr(new);
        match self.data.compare_exchange(current_ptr, new_ptr, Ordering::AcqRel, Ordering::Acquire) {
            Ok(old) => {
                Ok(RcuSyncHandle {
                    data: old
                })
            },
            Err(old) => {
                Err((
                    // SAFETY: `new_ptr` is from `new`.
                    unsafe { ptr_to_option_box(new_ptr) }, 
                    // SAFETY: `old` is obtained from `self.data`.
                    unsafe { RcuReference::new(old) }
                ))
            },
        }
    }
/// Compare the current RCU pointer with `expect`, and if equal, update it with `new`, 
/// return the synchronization handle. Otherwise, return the reference to the current pointer.
/// The entire operation is guaranteed to be atomic.
Compare the current RCU pointer with `expect`, and if equal, update it with `new`,
return the synchronization handle. Otherwise, return the reference to the current pointer.
The entire operation is guaranteed to be atomic.
Compare the current RCU pointer with ` expect ` and if equal update it with ` new ` return the synchronization handle . Otherwise return the reference to the current pointer . The entire operation is guaranteed to be atomic .
pub fn compare_update(&self, current: Option<RcuReference<'_, T>>, new: Option<Box<T>>) -> Result<RcuSyncHandle<T>, (Option<Box<T>>, Option<RcuReference<'_, T>>)> {
        let current_ptr = current.map_or(ptr::null(), RcuReference::into_inner) as *mut T;
        let new_ptr = option_box_to_ptr(new);
        match self.data.compare_exchange(current_ptr, new_ptr, Ordering::AcqRel, Ordering::Acquire) {
            Ok(old) => {
                Ok(RcuSyncHandle {
                    data: old
                })
            },
            Err(old) => {
                Err((
                    // SAFETY: `new_ptr` is from `new`.
                    unsafe { ptr_to_option_box(new_ptr) }, 
                    // SAFETY: `old` is obtained from `self.data`.
                    unsafe { RcuReference::new(old) }
                ))
            },
        }
    }
pub fn compare_update ( & self , current : Option < RcuReference < ' _ , T > > , new : Option < Box < T > > ) -> Result < RcuSyncHandle < T > , ( Option < Box < T > > , Option < RcuReference < ' _ , T > > ) > { let current_ptr = current . map_or ( ptr :: null ( ) , RcuReference :: into_inner ) as * mut T ; let new_ptr = option_box_to_ptr ( new ) ; match self . data . compare_exchange ( current_ptr , new_ptr , Ordering :: AcqRel , Ordering :: Acquire ) { Ok ( old ) => { Ok ( RcuSyncHandle { data : old } ) } , Err ( old ) => { Err ( ( // SAFETY: `new_ptr` is from `new`. unsafe { ptr_to_option_box ( new_ptr ) } , // SAFETY: `old` is obtained from `self.data`. unsafe { RcuReference :: new ( old ) } ) ) } , } }
Compare the current RCU pointer with `expect`, and if equal, update it with `new`,
return the synchronization handle.
Compare the current RCU pointer with ` expect ` and if equal update it with ` new ` return the synchronization handle .
&self
current
Option<RcuReference<'_, T>>
new
Option<Box<T>>
&self
current
Option<RcuReference<'_, T>>
new
Option<Box<T>>