Skip to content

Commit

Permalink
more bindings updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Arlie Davis committed Jun 3, 2024
1 parent 2667b14 commit 021fd1e
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 66 deletions.
50 changes: 32 additions & 18 deletions crates/samples/components/json_validator_winrt/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,28 @@ impl windows_core::RuntimeName for IJsonValidator {
}
impl IJsonValidator_Vtbl {
pub const fn new<
Identity: windows_core::IUnknownImpl<Impl = Impl>,
Impl: IJsonValidator_Impl,
Identity: windows_core::IUnknownImpl,
OuterToImpl: ::windows_core::ComGetImpl<Identity>,
const OFFSET: isize,
>() -> IJsonValidator_Vtbl {
>() -> IJsonValidator_Vtbl
where
OuterToImpl::Impl: IJsonValidator_Impl,
{
unsafe extern "system" fn Validate<
Identity: windows_core::IUnknownImpl<Impl = Impl>,
Impl: IJsonValidator_Impl,
Identity: windows_core::IUnknownImpl,
OuterToImpl: ::windows_core::ComGetImpl<Identity>,
const OFFSET: isize,
>(
this: *mut core::ffi::c_void,
value: core::mem::MaybeUninit<windows_core::HSTRING>,
result__: *mut core::mem::MaybeUninit<windows_core::HSTRING>,
) -> windows_core::HRESULT {
let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
let this = (*this).get_impl();
) -> windows_core::HRESULT
where
OuterToImpl::Impl: IJsonValidator_Impl,
{
let this_outer: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
let this = OuterToImpl::get_impl(this_outer);
match IJsonValidator_Impl::Validate(this, core::mem::transmute(&value)) {
Ok(ok__) => {
core::ptr::write(result__, core::mem::transmute_copy(&ok__));
Expand All @@ -140,7 +147,7 @@ impl IJsonValidator_Vtbl {
}
Self {
base__: windows_core::IInspectable_Vtbl::new::<Identity, IJsonValidator, OFFSET>(),
Validate: Validate::<Identity, Impl, OFFSET>,
Validate: Validate::<Identity, OuterToImpl, OFFSET>,
}
}
pub fn matches(iid: &windows_core::GUID) -> bool {
Expand All @@ -156,21 +163,28 @@ impl windows_core::RuntimeName for IJsonValidatorFactory {
}
impl IJsonValidatorFactory_Vtbl {
pub const fn new<
Identity: windows_core::IUnknownImpl<Impl = Impl>,
Impl: IJsonValidatorFactory_Impl,
Identity: windows_core::IUnknownImpl,
OuterToImpl: ::windows_core::ComGetImpl<Identity>,
const OFFSET: isize,
>() -> IJsonValidatorFactory_Vtbl {
>() -> IJsonValidatorFactory_Vtbl
where
OuterToImpl::Impl: IJsonValidatorFactory_Impl,
{
unsafe extern "system" fn CreateInstance<
Identity: windows_core::IUnknownImpl<Impl = Impl>,
Impl: IJsonValidatorFactory_Impl,
Identity: windows_core::IUnknownImpl,
OuterToImpl: ::windows_core::ComGetImpl<Identity>,
const OFFSET: isize,
>(
this: *mut core::ffi::c_void,
schema: core::mem::MaybeUninit<windows_core::HSTRING>,
result__: *mut *mut core::ffi::c_void,
) -> windows_core::HRESULT {
let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
let this = (*this).get_impl();
) -> windows_core::HRESULT
where
OuterToImpl::Impl: IJsonValidatorFactory_Impl,
{
let this_outer: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
let this = OuterToImpl::get_impl(this_outer);
match IJsonValidatorFactory_Impl::CreateInstance(this, core::mem::transmute(&schema)) {
Ok(ok__) => {
core::ptr::write(result__, core::mem::transmute_copy(&ok__));
Expand All @@ -183,7 +197,7 @@ impl IJsonValidatorFactory_Vtbl {
Self {
base__: windows_core::IInspectable_Vtbl::new::<Identity, IJsonValidatorFactory, OFFSET>(
),
CreateInstance: CreateInstance::<Identity, Impl, OFFSET>,
CreateInstance: CreateInstance::<Identity, OuterToImpl, OFFSET>,
}
}
pub fn matches(iid: &windows_core::GUID) -> bool {
Expand Down
130 changes: 82 additions & 48 deletions crates/tests/component/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,31 @@ pub mod Nested {
}
impl IThing_Vtbl {
pub const fn new<
Identity: windows_core::IUnknownImpl<Impl = Impl>,
Impl: IThing_Impl,
Identity: windows_core::IUnknownImpl,
OuterToImpl: ::windows_core::ComGetImpl<Identity>,
const OFFSET: isize,
>() -> IThing_Vtbl {
>() -> IThing_Vtbl
where
OuterToImpl::Impl: IThing_Impl,
{
unsafe extern "system" fn Method<
Identity: windows_core::IUnknownImpl<Impl = Impl>,
Impl: IThing_Impl,
Identity: windows_core::IUnknownImpl,
OuterToImpl: ::windows_core::ComGetImpl<Identity>,
const OFFSET: isize,
>(
this: *mut core::ffi::c_void,
) -> windows_core::HRESULT {
let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
let this = (*this).get_impl();
) -> windows_core::HRESULT
where
OuterToImpl::Impl: IThing_Impl,
{
let this_outer: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
let this = OuterToImpl::get_impl(this_outer);
IThing_Impl::Method(this).into()
}
Self {
base__: windows_core::IInspectable_Vtbl::new::<Identity, IThing, OFFSET>(),
Method: Method::<Identity, Impl, OFFSET>,
Method: Method::<Identity, OuterToImpl, OFFSET>,
}
}
pub fn matches(iid: &windows_core::GUID) -> bool {
Expand Down Expand Up @@ -433,20 +440,27 @@ impl windows_core::RuntimeName for IClass {
}
impl IClass_Vtbl {
pub const fn new<
Identity: windows_core::IUnknownImpl<Impl = Impl>,
Impl: IClass_Impl,
Identity: windows_core::IUnknownImpl,
OuterToImpl: ::windows_core::ComGetImpl<Identity>,
const OFFSET: isize,
>() -> IClass_Vtbl {
>() -> IClass_Vtbl
where
OuterToImpl::Impl: IClass_Impl,
{
unsafe extern "system" fn Property<
Identity: windows_core::IUnknownImpl<Impl = Impl>,
Impl: IClass_Impl,
Identity: windows_core::IUnknownImpl,
OuterToImpl: ::windows_core::ComGetImpl<Identity>,
const OFFSET: isize,
>(
this: *mut core::ffi::c_void,
result__: *mut i32,
) -> windows_core::HRESULT {
let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
let this = (*this).get_impl();
) -> windows_core::HRESULT
where
OuterToImpl::Impl: IClass_Impl,
{
let this_outer: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
let this = OuterToImpl::get_impl(this_outer);
match IClass_Impl::Property(this) {
Ok(ok__) => {
core::ptr::write(result__, core::mem::transmute_copy(&ok__));
Expand All @@ -456,27 +470,35 @@ impl IClass_Vtbl {
}
}
unsafe extern "system" fn SetProperty<
Identity: windows_core::IUnknownImpl<Impl = Impl>,
Impl: IClass_Impl,
Identity: windows_core::IUnknownImpl,
OuterToImpl: ::windows_core::ComGetImpl<Identity>,
const OFFSET: isize,
>(
this: *mut core::ffi::c_void,
value: i32,
) -> windows_core::HRESULT {
let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
let this = (*this).get_impl();
) -> windows_core::HRESULT
where
OuterToImpl::Impl: IClass_Impl,
{
let this_outer: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
let this = OuterToImpl::get_impl(this_outer);
IClass_Impl::SetProperty(this, value).into()
}
unsafe extern "system" fn Flags<
Identity: windows_core::IUnknownImpl<Impl = Impl>,
Impl: IClass_Impl,
Identity: windows_core::IUnknownImpl,
OuterToImpl: ::windows_core::ComGetImpl<Identity>,
const OFFSET: isize,
>(
this: *mut core::ffi::c_void,
result__: *mut Flags,
) -> windows_core::HRESULT {
let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
let this = (*this).get_impl();
) -> windows_core::HRESULT
where
OuterToImpl::Impl: IClass_Impl,
{
let this_outer: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
let this = OuterToImpl::get_impl(this_outer);
match IClass_Impl::Flags(this) {
Ok(ok__) => {
core::ptr::write(result__, core::mem::transmute_copy(&ok__));
Expand All @@ -486,8 +508,8 @@ impl IClass_Vtbl {
}
}
unsafe extern "system" fn Int32Array<
Identity: windows_core::IUnknownImpl<Impl = Impl>,
Impl: IClass_Impl,
Identity: windows_core::IUnknownImpl,
OuterToImpl: ::windows_core::ComGetImpl<Identity>,
const OFFSET: isize,
>(
this: *mut core::ffi::c_void,
Expand All @@ -499,9 +521,13 @@ impl IClass_Vtbl {
c: *mut *mut i32,
result_size__: *mut u32,
result__: *mut *mut i32,
) -> windows_core::HRESULT {
let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
let this = (*this).get_impl();
) -> windows_core::HRESULT
where
OuterToImpl::Impl: IClass_Impl,
{
let this_outer: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
let this = OuterToImpl::get_impl(this_outer);
match IClass_Impl::Int32Array(
this,
core::slice::from_raw_parts(core::mem::transmute_copy(&a), a_array_size as usize),
Expand All @@ -525,8 +551,8 @@ impl IClass_Vtbl {
}
}
unsafe extern "system" fn StringArray<
Identity: windows_core::IUnknownImpl<Impl = Impl>,
Impl: IClass_Impl,
Identity: windows_core::IUnknownImpl,
OuterToImpl: ::windows_core::ComGetImpl<Identity>,
const OFFSET: isize,
>(
this: *mut core::ffi::c_void,
Expand All @@ -538,9 +564,13 @@ impl IClass_Vtbl {
c: *mut *mut core::mem::MaybeUninit<windows_core::HSTRING>,
result_size__: *mut u32,
result__: *mut *mut core::mem::MaybeUninit<windows_core::HSTRING>,
) -> windows_core::HRESULT {
let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
let this = (*this).get_impl();
) -> windows_core::HRESULT
where
OuterToImpl::Impl: IClass_Impl,
{
let this_outer: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
let this = OuterToImpl::get_impl(this_outer);
match IClass_Impl::StringArray(
this,
core::slice::from_raw_parts(core::mem::transmute_copy(&a), a_array_size as usize),
Expand All @@ -564,18 +594,22 @@ impl IClass_Vtbl {
}
}
unsafe extern "system" fn Input<
Identity: windows_core::IUnknownImpl<Impl = Impl>,
Impl: IClass_Impl,
Identity: windows_core::IUnknownImpl,
OuterToImpl: ::windows_core::ComGetImpl<Identity>,
const OFFSET: isize,
>(
this: *mut core::ffi::c_void,
a: *mut core::ffi::c_void,
b: *mut core::ffi::c_void,
c: *mut core::ffi::c_void,
d: *mut core::ffi::c_void,
) -> windows_core::HRESULT {
let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
let this = (*this).get_impl();
) -> windows_core::HRESULT
where
OuterToImpl::Impl: IClass_Impl,
{
let this_outer: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
let this = OuterToImpl::get_impl(this_outer);
IClass_Impl::Input(
this,
windows_core::from_raw_borrowed(&a),
Expand All @@ -587,12 +621,12 @@ impl IClass_Vtbl {
}
Self {
base__: windows_core::IInspectable_Vtbl::new::<Identity, IClass, OFFSET>(),
Property: Property::<Identity, Impl, OFFSET>,
SetProperty: SetProperty::<Identity, Impl, OFFSET>,
Flags: Flags::<Identity, Impl, OFFSET>,
Int32Array: Int32Array::<Identity, Impl, OFFSET>,
StringArray: StringArray::<Identity, Impl, OFFSET>,
Input: Input::<Identity, Impl, OFFSET>,
Property: Property::<Identity, OuterToImpl, OFFSET>,
SetProperty: SetProperty::<Identity, OuterToImpl, OFFSET>,
Flags: Flags::<Identity, OuterToImpl, OFFSET>,
Int32Array: Int32Array::<Identity, OuterToImpl, OFFSET>,
StringArray: StringArray::<Identity, OuterToImpl, OFFSET>,
Input: Input::<Identity, OuterToImpl, OFFSET>,
}
}
pub fn matches(iid: &windows_core::GUID) -> bool {
Expand Down

0 comments on commit 021fd1e

Please sign in to comment.