fn query_interface_ts<TS: TypeSystem, TTarget: ComInterface + ?Sized>(
        &self,
    ) -> ComResult<ComRc<TTarget>>
    {
        // Try to get the IID.
        let iid = match TTarget::iid(TS::key()) {
            None => return Err(ComError::E_NOINTERFACE),
            Some(iid) => iid,
        };

        // Try to query interface using the iid.
        let iunk: &dyn RawIUnknown = &*self.as_raw_iunknown();
        match iunk.query_interface(iid) {
            Ok(ptr) => {
                // Interface was available. Convert the raw pointer into
                // a strong type-system specific InterfacePtr.
                //
                // The pointer has already been addref'd by query_interface
                // so it's safe to attach it here.
                unsafe {
                    let target_itf = raw::InterfacePtr::<TS, TTarget>::new(ptr);
                    match target_itf {
                        Some(itf) => Ok(ComRc::attach(ComItf::wrap(itf))),
                        None => Err(ComError::E_POINTER),
                    }
                }
            }
            Err(e) => Err(e.into()),
        }
    }
/// Tries to convert the ComRc into a different interface within a single
/// type system. Used to implement the generic conversion method.
Tries to convert the ComRc into a different interface within a single
type system. Used to implement the generic conversion method.
Tries to convert the ComRc into a different interface within a single type system . Used to implement the generic conversion method .
fn query_interface_ts<TS: TypeSystem, TTarget: ComInterface + ?Sized>(
        &self,
    ) -> ComResult<ComRc<TTarget>>
    {
        // Try to get the IID.
        let iid = match TTarget::iid(TS::key()) {
            None => return Err(ComError::E_NOINTERFACE),
            Some(iid) => iid,
        };
        // Try to query interface using the iid.
        let iunk: &dyn RawIUnknown = &*self.as_raw_iunknown();
        match iunk.query_interface(iid) {
            Ok(ptr) => {
                // Interface was available. Convert the raw pointer into
                // a strong type-system specific InterfacePtr.
                //
                // The pointer has already been addref'd by query_interface
                // so it's safe to attach it here.
                unsafe {
                    let target_itf = raw::InterfacePtr::<TS, TTarget>::new(ptr);
                    match target_itf {
                        Some(itf) => Ok(ComRc::attach(ComItf::wrap(itf))),
                        None => Err(ComError::E_POINTER),
                    }
                }
            }
            Err(e) => Err(e.into()),
        }
    }
fn query_interface_ts < TS : TypeSystem , TTarget : ComInterface + ? Sized > ( & self , ) -> ComResult < ComRc < TTarget > > { // Try to get the IID. let iid = match TTarget :: iid ( TS :: key ( ) ) { None => return Err ( ComError :: E_NOINTERFACE ) , Some ( iid ) => iid , } ; // Try to query interface using the iid. let iunk : & dyn RawIUnknown = & * self . as_raw_iunknown ( ) ; match iunk . query_interface ( iid ) { Ok ( ptr ) => { // Interface was available. Convert the raw pointer into // a strong type-system specific InterfacePtr. // // The pointer has already been addref'd by query_interface // so it's safe to attach it here. unsafe { let target_itf = raw :: InterfacePtr :: < TS , TTarget > :: new ( ptr ) ; match target_itf { Some ( itf ) => Ok ( ComRc :: attach ( ComItf :: wrap ( itf ) ) ) , None => Err ( ComError :: E_POINTER ) , } } } Err ( e ) => Err ( e . into ( ) ) , } }
Tries to convert the ComRc into a different interface within a single
type system.
Tries to convert the ComRc into a different interface within a single type system .
&self
&self