Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/rust/windows-core/src/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  param.rs

  Sprache: Rust
 

use super::*;
use core::mem::transmute_copy;
use core::mem::zeroed;

/// Provides automatic parameter conversion in cases where the Windows API expects implicit conversion support.
///
/// There is no need to implement this trait. Blanket implementations are provided for all applicable Windows types.
pub trait Param<T: TypeKind, C = <T as TypeKind>::TypeKind>: Sized
where
    T: Type<T>,
{
    #[doc(hidden)]
    unsafe fn param(self) -> ParamValue<T>;
}

impl<T> Param<T> for Option<&T>
where
    T: Type<T>,
{
    unsafe fn param(self) -> ParamValue<T> {
        ParamValue::Borrowed(match self {
            Some(item) => transmute_copy(item),
            None => zeroed(),
        })
    }
}

impl<T, U> Param<T, InterfaceType> for &U
where
    T: TypeKind<TypeKind = InterfaceType> + Clone,
    T: Interface,
    U: Interface,
    U: imp::CanInto<T>,
{
    unsafe fn param(self) -> ParamValue<T> {
        if U::QUERY {
            self.cast()
                .map_or(ParamValue::Borrowed(zeroed()), |ok| ParamValue::Owned(ok))
        } else {
            ParamValue::Borrowed(transmute_copy(self))
        }
    }
}

impl<T> Param<T, CloneType> for &T
where
    T: TypeKind<TypeKind = CloneType> + Clone,
{
    unsafe fn param(self) -> ParamValue<T> {
        ParamValue::Borrowed(transmute_copy(self))
    }
}

impl<T, U> Param<T, CopyType> for U
where
    T: TypeKind<TypeKind = CopyType> + Clone,
    U: TypeKind<TypeKind = CopyType> + Clone,
    U: imp::CanInto<T>,
{
    unsafe fn param(self) -> ParamValue<T> {
        ParamValue::Owned(transmute_copy(&self))
    }
}

Messung V0.5 in Prozent
C=85 H=93 G=88

¤ Dauer der Verarbeitung: 0.8 Sekunden  (vorverarbeitet am  2026-06-18) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.