fn try_lock(&self, locked_state: usize) -> Result<()> {
        match STATE.compare_exchange(
            UNINITIALIZED,
            locked_state,
            Ordering::SeqCst,
            Ordering::SeqCst,
        ) {
            Err(INITIALIZING) => {
                // If the logger is initializing, an error will be returned.
                return Err(LoggerError::IsInitializing);
            }
            Err(INITIALIZED) => {
                // If the logger was already initialized, an error will be returned.
                return Err(LoggerError::AlreadyInitialized);
            }
            _ => {}
        }

        Ok(())
    }
/// Try to change the state of the logger.
/// This method will succeed only if the logger is UNINITIALIZED.
Try to change the state of the logger.
This method will succeed only if the logger is UNINITIALIZED.
Try to change the state of the logger . This method will succeed only if the logger is UNINITIALIZED .
fn try_lock(&self, locked_state: usize) -> Result<()> {
        match STATE.compare_exchange(
            UNINITIALIZED,
            locked_state,
            Ordering::SeqCst,
            Ordering::SeqCst,
        ) {
            Err(INITIALIZING) => {
                // If the logger is initializing, an error will be returned.
                return Err(LoggerError::IsInitializing);
            }
            Err(INITIALIZED) => {
                // If the logger was already initialized, an error will be returned.
                return Err(LoggerError::AlreadyInitialized);
            }
            _ => {}
        }
        Ok(())
    }
fn try_lock ( & self , locked_state : usize ) -> Result < ( ) > { match STATE . compare_exchange ( UNINITIALIZED , locked_state , Ordering :: SeqCst , Ordering :: SeqCst , ) { Err ( INITIALIZING ) => { // If the logger is initializing, an error will be returned. return Err ( LoggerError :: IsInitializing ) ; } Err ( INITIALIZED ) => { // If the logger was already initialized, an error will be returned. return Err ( LoggerError :: AlreadyInitialized ) ; } _ => { } } Ok ( ( ) ) }
Try to change the state of the logger.
Try to change the state of the logger .
&self
locked_state
usize