pub fn store_error<E>(error: E) -> ComError
where
    E: Into<ComError>,
{
    // Convet the error.
    let com_error = error.into();

    match com_error.error_info {
        Some(ref error_info) => {
            // ComError contains ErrorInfo. We need to set this in the OS error
            // store.

            // Construct the COM class used for IErrorInfo. The class contains the
            // description in memory.
            let info = ComBox::<ErrorInfo>::new(error_info.clone());

            // Store the IErrorInfo pointer in the SetErrorInfo.
            let rc = ComRc::<dyn IErrorInfo>::from(info);
            let ptr = ComItf::ptr(&rc).expect("Intercom did not implement correct type system");
            unsafe {
                error_store::SetErrorInfo(0, Some(ptr));
            }
        }
        None => {
            // No error info in the ComError.
            unsafe {
                error_store::SetErrorInfo(0, None);
            }
        }
    }

    // Return the HRESULT of the original error.
    com_error
}
/// Extracts the HRESULT from the error result and stores the extended error
/// information in thread memory so it can be fetched by the COM client.
Extracts the HRESULT from the error result and stores the extended error
information in thread memory so it can be fetched by the COM client.
Extracts the HRESULT from the error result and stores the extended error information in thread memory so it can be fetched by the COM client .
pub fn store_error<E>(error: E) -> ComError
where
    E: Into<ComError>,
{
    // Convet the error.
    let com_error = error.into();
    match com_error.error_info {
        Some(ref error_info) => {
            // ComError contains ErrorInfo. We need to set this in the OS error
            // store.
            // Construct the COM class used for IErrorInfo. The class contains the
            // description in memory.
            let info = ComBox::<ErrorInfo>::new(error_info.clone());
            // Store the IErrorInfo pointer in the SetErrorInfo.
            let rc = ComRc::<dyn IErrorInfo>::from(info);
            let ptr = ComItf::ptr(&rc).expect("Intercom did not implement correct type system");
            unsafe {
                error_store::SetErrorInfo(0, Some(ptr));
            }
        }
        None => {
            // No error info in the ComError.
            unsafe {
                error_store::SetErrorInfo(0, None);
            }
        }
    }
    // Return the HRESULT of the original error.
    com_error
}
pub fn store_error < E > ( error : E ) -> ComError where E : Into < ComError > , { // Convet the error. let com_error = error . into ( ) ; match com_error . error_info { Some ( ref error_info ) => { // ComError contains ErrorInfo. We need to set this in the OS error // store. // Construct the COM class used for IErrorInfo. The class contains the // description in memory. let info = ComBox :: < ErrorInfo > :: new ( error_info . clone ( ) ) ; // Store the IErrorInfo pointer in the SetErrorInfo. let rc = ComRc :: < dyn IErrorInfo > :: from ( info ) ; let ptr = ComItf :: ptr ( & rc ) . expect ( " " ) ; unsafe { error_store :: SetErrorInfo ( 0 , Some ( ptr ) ) ; } } None => { // No error info in the ComError. unsafe { error_store :: SetErrorInfo ( 0 , None ) ; } } } // Return the HRESULT of the original error. com_error }
Extracts the HRESULT from the error result and stores the extended error
information in thread memory so it can be fetched by the COM client.
Extracts the HRESULT from the error result and stores the extended error information in thread memory so it can be fetched by the COM client .
error
E
error
E