Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary convertible parameters #2071

Merged
merged 2 commits into from Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions crates/libs/metadata/src/reader/mod.rs
Expand Up @@ -854,14 +854,17 @@ impl<'a> Reader<'a> {
pub fn type_def_is_contract(&self, row: TypeDef) -> bool {
self.type_def_attributes(row).any(|attribute| self.attribute_name(attribute) == "ApiContractAttribute")
}
fn type_def_is_composable(&self, row: TypeDef) -> bool {
self.type_def_attributes(row).any(|attribute| self.attribute_name(attribute) == "ComposableAttribute")
}
pub fn type_def_is_udt(&self, row: TypeDef) -> bool {
// TODO: should this just check whether the struct has > 1 fields rather than type_def_is_handle?
self.type_def_kind(row) == TypeKind::Struct && !self.type_def_is_handle(row)
}
pub fn type_def_is_borrowed(&self, row: TypeDef) -> bool {
fn type_def_is_borrowed(&self, row: TypeDef) -> bool {
match self.type_def_kind(row) {
TypeKind::Class => true,
TypeKind::Delegate => self.type_def_flags(row).winrt(),
TypeKind::Class => self.type_def_is_composable(row),
TypeKind::Delegate => false,
_ => !self.type_def_is_blittable(row),
}
}
Expand Down
21 changes: 6 additions & 15 deletions crates/libs/windows/src/Windows/AI/MachineLearning/Preview/mod.rs
Expand Up @@ -866,13 +866,10 @@ impl LearningModelBindingPreview {
}
#[doc = "*Required features: `\"deprecated\"`*"]
#[cfg(feature = "deprecated")]
pub fn CreateFromModel<'a, P0>(model: P0) -> ::windows::core::Result<LearningModelBindingPreview>
where
P0: ::std::convert::Into<::windows::core::InParam<'a, LearningModelPreview>>,
{
pub fn CreateFromModel(model: &LearningModelPreview) -> ::windows::core::Result<LearningModelBindingPreview> {
Self::ILearningModelBindingPreviewFactory(|this| unsafe {
let mut result__ = ::core::mem::MaybeUninit::zeroed();
(::windows::core::Vtable::vtable(this).CreateFromModel)(::windows::core::Vtable::as_raw(this), model.into().abi(), result__.as_mut_ptr()).from_abi::<LearningModelBindingPreview>(result__)
(::windows::core::Vtable::vtable(this).CreateFromModel)(::windows::core::Vtable::as_raw(this), ::core::mem::transmute_copy(model), result__.as_mut_ptr()).from_abi::<LearningModelBindingPreview>(result__)
})
}
#[doc = "*Required features: `\"Foundation_Collections\"`*"]
Expand Down Expand Up @@ -1315,14 +1312,11 @@ pub struct LearningModelPreview(::windows::core::IUnknown);
impl LearningModelPreview {
#[doc = "*Required features: `\"Foundation\"`, `\"deprecated\"`*"]
#[cfg(all(feature = "Foundation", feature = "deprecated"))]
pub fn EvaluateAsync<'a, P0>(&self, binding: P0, correlationid: &::windows::core::HSTRING) -> ::windows::core::Result<super::super::super::Foundation::IAsyncOperation<LearningModelEvaluationResultPreview>>
where
P0: ::std::convert::Into<::windows::core::InParam<'a, LearningModelBindingPreview>>,
{
pub fn EvaluateAsync(&self, binding: &LearningModelBindingPreview, correlationid: &::windows::core::HSTRING) -> ::windows::core::Result<super::super::super::Foundation::IAsyncOperation<LearningModelEvaluationResultPreview>> {
let this = self;
unsafe {
let mut result__ = ::core::mem::MaybeUninit::zeroed();
(::windows::core::Vtable::vtable(this).EvaluateAsync)(::windows::core::Vtable::as_raw(this), binding.into().abi(), ::core::mem::transmute_copy(correlationid), result__.as_mut_ptr()).from_abi::<super::super::super::Foundation::IAsyncOperation<LearningModelEvaluationResultPreview>>(result__)
(::windows::core::Vtable::vtable(this).EvaluateAsync)(::windows::core::Vtable::as_raw(this), ::core::mem::transmute_copy(binding), ::core::mem::transmute_copy(correlationid), result__.as_mut_ptr()).from_abi::<super::super::super::Foundation::IAsyncOperation<LearningModelEvaluationResultPreview>>(result__)
}
}
#[doc = "*Required features: `\"Foundation_Collections\"`, `\"deprecated\"`*"]
Expand Down Expand Up @@ -1358,12 +1352,9 @@ impl LearningModelPreview {
}
#[doc = "*Required features: `\"deprecated\"`*"]
#[cfg(feature = "deprecated")]
pub fn SetInferencingOptions<'a, P0>(&self, value: P0) -> ::windows::core::Result<()>
where
P0: ::std::convert::Into<::windows::core::InParam<'a, InferencingOptionsPreview>>,
{
pub fn SetInferencingOptions(&self, value: &InferencingOptionsPreview) -> ::windows::core::Result<()> {
let this = self;
unsafe { (::windows::core::Vtable::vtable(this).SetInferencingOptions)(::windows::core::Vtable::as_raw(this), value.into().abi()).ok() }
unsafe { (::windows::core::Vtable::vtable(this).SetInferencingOptions)(::windows::core::Vtable::as_raw(this), ::core::mem::transmute_copy(value)).ok() }
}
#[doc = "*Required features: `\"Foundation\"`, `\"Storage\"`, `\"deprecated\"`*"]
#[cfg(all(feature = "Foundation", feature = "Storage", feature = "deprecated"))]
Expand Down
52 changes: 14 additions & 38 deletions crates/libs/windows/src/Windows/AI/MachineLearning/mod.rs
Expand Up @@ -1778,13 +1778,10 @@ impl ImageFeatureValue {
}
#[doc = "*Required features: `\"Media\"`*"]
#[cfg(feature = "Media")]
pub fn CreateFromVideoFrame<'a, P0>(image: P0) -> ::windows::core::Result<ImageFeatureValue>
where
P0: ::std::convert::Into<::windows::core::InParam<'a, super::super::Media::VideoFrame>>,
{
pub fn CreateFromVideoFrame(image: &super::super::Media::VideoFrame) -> ::windows::core::Result<ImageFeatureValue> {
Self::IImageFeatureValueStatics(|this| unsafe {
let mut result__ = ::core::mem::MaybeUninit::zeroed();
(::windows::core::Vtable::vtable(this).CreateFromVideoFrame)(::windows::core::Vtable::as_raw(this), image.into().abi(), result__.as_mut_ptr()).from_abi::<ImageFeatureValue>(result__)
(::windows::core::Vtable::vtable(this).CreateFromVideoFrame)(::windows::core::Vtable::as_raw(this), ::core::mem::transmute_copy(image), result__.as_mut_ptr()).from_abi::<ImageFeatureValue>(result__)
})
}
pub fn Kind(&self) -> ::windows::core::Result<LearningModelFeatureKind> {
Expand Down Expand Up @@ -2176,13 +2173,10 @@ impl LearningModelBinding {
let this = self;
unsafe { (::windows::core::Vtable::vtable(this).Clear)(::windows::core::Vtable::as_raw(this)).ok() }
}
pub fn CreateFromSession<'a, P0>(session: P0) -> ::windows::core::Result<LearningModelBinding>
where
P0: ::std::convert::Into<::windows::core::InParam<'a, LearningModelSession>>,
{
pub fn CreateFromSession(session: &LearningModelSession) -> ::windows::core::Result<LearningModelBinding> {
Self::ILearningModelBindingFactory(|this| unsafe {
let mut result__ = ::core::mem::MaybeUninit::zeroed();
(::windows::core::Vtable::vtable(this).CreateFromSession)(::windows::core::Vtable::as_raw(this), session.into().abi(), result__.as_mut_ptr()).from_abi::<LearningModelBinding>(result__)
(::windows::core::Vtable::vtable(this).CreateFromSession)(::windows::core::Vtable::as_raw(this), ::core::mem::transmute_copy(session), result__.as_mut_ptr()).from_abi::<LearningModelBinding>(result__)
})
}
#[doc = "*Required features: `\"Foundation_Collections\"`*"]
Expand Down Expand Up @@ -2597,14 +2591,11 @@ impl LearningModelSession {
}
#[doc = "*Required features: `\"Foundation\"`*"]
#[cfg(feature = "Foundation")]
pub fn EvaluateAsync<'a, P0>(&self, bindings: P0, correlationid: &::windows::core::HSTRING) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<LearningModelEvaluationResult>>
where
P0: ::std::convert::Into<::windows::core::InParam<'a, LearningModelBinding>>,
{
pub fn EvaluateAsync(&self, bindings: &LearningModelBinding, correlationid: &::windows::core::HSTRING) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<LearningModelEvaluationResult>> {
let this = self;
unsafe {
let mut result__ = ::core::mem::MaybeUninit::zeroed();
(::windows::core::Vtable::vtable(this).EvaluateAsync)(::windows::core::Vtable::as_raw(this), bindings.into().abi(), ::core::mem::transmute_copy(correlationid), result__.as_mut_ptr()).from_abi::<super::super::Foundation::IAsyncOperation<LearningModelEvaluationResult>>(result__)
(::windows::core::Vtable::vtable(this).EvaluateAsync)(::windows::core::Vtable::as_raw(this), ::core::mem::transmute_copy(bindings), ::core::mem::transmute_copy(correlationid), result__.as_mut_ptr()).from_abi::<super::super::Foundation::IAsyncOperation<LearningModelEvaluationResult>>(result__)
}
}
#[doc = "*Required features: `\"Foundation_Collections\"`*"]
Expand All @@ -2620,14 +2611,11 @@ impl LearningModelSession {
(::windows::core::Vtable::vtable(this).EvaluateFeaturesAsync)(::windows::core::Vtable::as_raw(this), features.try_into().map_err(|e| e.into())?.abi(), ::core::mem::transmute_copy(correlationid), result__.as_mut_ptr()).from_abi::<super::super::Foundation::IAsyncOperation<LearningModelEvaluationResult>>(result__)
}
}
pub fn Evaluate<'a, P0>(&self, bindings: P0, correlationid: &::windows::core::HSTRING) -> ::windows::core::Result<LearningModelEvaluationResult>
where
P0: ::std::convert::Into<::windows::core::InParam<'a, LearningModelBinding>>,
{
pub fn Evaluate(&self, bindings: &LearningModelBinding, correlationid: &::windows::core::HSTRING) -> ::windows::core::Result<LearningModelEvaluationResult> {
let this = self;
unsafe {
let mut result__ = ::core::mem::MaybeUninit::zeroed();
(::windows::core::Vtable::vtable(this).Evaluate)(::windows::core::Vtable::as_raw(this), bindings.into().abi(), ::core::mem::transmute_copy(correlationid), result__.as_mut_ptr()).from_abi::<LearningModelEvaluationResult>(result__)
(::windows::core::Vtable::vtable(this).Evaluate)(::windows::core::Vtable::as_raw(this), ::core::mem::transmute_copy(bindings), ::core::mem::transmute_copy(correlationid), result__.as_mut_ptr()).from_abi::<LearningModelEvaluationResult>(result__)
}
}
#[doc = "*Required features: `\"Foundation_Collections\"`*"]
Expand All @@ -2643,34 +2631,22 @@ impl LearningModelSession {
(::windows::core::Vtable::vtable(this).EvaluateFeatures)(::windows::core::Vtable::as_raw(this), features.try_into().map_err(|e| e.into())?.abi(), ::core::mem::transmute_copy(correlationid), result__.as_mut_ptr()).from_abi::<LearningModelEvaluationResult>(result__)
}
}
pub fn CreateFromModel<'a, P0>(model: P0) -> ::windows::core::Result<LearningModelSession>
where
P0: ::std::convert::Into<::windows::core::InParam<'a, LearningModel>>,
{
pub fn CreateFromModel(model: &LearningModel) -> ::windows::core::Result<LearningModelSession> {
Self::ILearningModelSessionFactory(|this| unsafe {
let mut result__ = ::core::mem::MaybeUninit::zeroed();
(::windows::core::Vtable::vtable(this).CreateFromModel)(::windows::core::Vtable::as_raw(this), model.into().abi(), result__.as_mut_ptr()).from_abi::<LearningModelSession>(result__)
(::windows::core::Vtable::vtable(this).CreateFromModel)(::windows::core::Vtable::as_raw(this), ::core::mem::transmute_copy(model), result__.as_mut_ptr()).from_abi::<LearningModelSession>(result__)
})
}
pub fn CreateFromModelOnDevice<'a, P0, P1>(model: P0, devicetorunon: P1) -> ::windows::core::Result<LearningModelSession>
where
P0: ::std::convert::Into<::windows::core::InParam<'a, LearningModel>>,
P1: ::std::convert::Into<::windows::core::InParam<'a, LearningModelDevice>>,
{
pub fn CreateFromModelOnDevice(model: &LearningModel, devicetorunon: &LearningModelDevice) -> ::windows::core::Result<LearningModelSession> {
Self::ILearningModelSessionFactory(|this| unsafe {
let mut result__ = ::core::mem::MaybeUninit::zeroed();
(::windows::core::Vtable::vtable(this).CreateFromModelOnDevice)(::windows::core::Vtable::as_raw(this), model.into().abi(), devicetorunon.into().abi(), result__.as_mut_ptr()).from_abi::<LearningModelSession>(result__)
(::windows::core::Vtable::vtable(this).CreateFromModelOnDevice)(::windows::core::Vtable::as_raw(this), ::core::mem::transmute_copy(model), ::core::mem::transmute_copy(devicetorunon), result__.as_mut_ptr()).from_abi::<LearningModelSession>(result__)
})
}
pub fn CreateFromModelOnDeviceWithSessionOptions<'a, P0, P1, P2>(model: P0, devicetorunon: P1, learningmodelsessionoptions: P2) -> ::windows::core::Result<LearningModelSession>
where
P0: ::std::convert::Into<::windows::core::InParam<'a, LearningModel>>,
P1: ::std::convert::Into<::windows::core::InParam<'a, LearningModelDevice>>,
P2: ::std::convert::Into<::windows::core::InParam<'a, LearningModelSessionOptions>>,
{
pub fn CreateFromModelOnDeviceWithSessionOptions(model: &LearningModel, devicetorunon: &LearningModelDevice, learningmodelsessionoptions: &LearningModelSessionOptions) -> ::windows::core::Result<LearningModelSession> {
Self::ILearningModelSessionFactory2(|this| unsafe {
let mut result__ = ::core::mem::MaybeUninit::zeroed();
(::windows::core::Vtable::vtable(this).CreateFromModelOnDeviceWithSessionOptions)(::windows::core::Vtable::as_raw(this), model.into().abi(), devicetorunon.into().abi(), learningmodelsessionoptions.into().abi(), result__.as_mut_ptr()).from_abi::<LearningModelSession>(result__)
(::windows::core::Vtable::vtable(this).CreateFromModelOnDeviceWithSessionOptions)(::windows::core::Vtable::as_raw(this), ::core::mem::transmute_copy(model), ::core::mem::transmute_copy(devicetorunon), ::core::mem::transmute_copy(learningmodelsessionoptions), result__.as_mut_ptr()).from_abi::<LearningModelSession>(result__)
})
}
#[doc(hidden)]
Expand Down
Expand Up @@ -15397,14 +15397,11 @@ impl SplashScreen {
}
#[doc = "*Required features: `\"Foundation\"`*"]
#[cfg(feature = "Foundation")]
pub fn Dismissed<'a, P0>(&self, handler: P0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken>
where
P0: ::std::convert::Into<::windows::core::InParam<'a, super::super::Foundation::TypedEventHandler<SplashScreen, ::windows::core::IInspectable>>>,
{
pub fn Dismissed(&self, handler: &super::super::Foundation::TypedEventHandler<SplashScreen, ::windows::core::IInspectable>) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> {
let this = self;
unsafe {
let mut result__ = ::core::mem::MaybeUninit::zeroed();
(::windows::core::Vtable::vtable(this).Dismissed)(::windows::core::Vtable::as_raw(this), handler.into().abi(), result__.as_mut_ptr()).from_abi::<super::super::Foundation::EventRegistrationToken>(result__)
(::windows::core::Vtable::vtable(this).Dismissed)(::windows::core::Vtable::as_raw(this), ::core::mem::transmute_copy(handler), result__.as_mut_ptr()).from_abi::<super::super::Foundation::EventRegistrationToken>(result__)
}
}
#[doc = "*Required features: `\"Foundation\"`*"]
Expand Down