Skip to content

Commit ca86a9f

Browse files
chore: support [email protected] library
1 parent 523711a commit ca86a9f

File tree

5 files changed

+19
-20
lines changed

5 files changed

+19
-20
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
## Unreleased
2+
3+
- chore: support [email protected] library
4+
15
## 0.5.0
26

3-
### Breaking Change
7+
### Breaking Changes
48
- chore: remove description requirement when creating an interaction
59

610
### Other

bin/install.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Future<void> downloadDependency(String name, String version) async {
5959

6060
void main() async {
6161
final dependencyName = Platform.isWindows ? 'pact_ffi' : 'libpact_ffi';
62-
final dependencyVersion = '0.0.1';
62+
final dependencyVersion = '0.3.3';
6363

6464
await downloadDependency(dependencyName, dependencyVersion);
6565
}

lib/src/bindings/signatures.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import 'types.dart';
77
/// bool -> Int8
88
/// i32 -> Int32
99
/// size_t -> IntPtr
10-
///
11-
/// TODO should c_char* type things be opaque
1210
1311
//
1412
typedef pactffi_init_native = Void Function(Pointer<Utf8> log_env_var);

lib/src/bindings/types.dart

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
import 'dart:ffi';
2-
import 'package:ffi/ffi.dart';
3-
4-
// TODO: I don't know how to handle some pointers in Dart:
5-
// TODO: * uintptr_t
6-
// TODO: * usize
72

3+
/// https://docs.rs/pact_ffi/latest/pact_ffi/mock_server/handles/struct.PactHandle.html
84
class PactHandle extends Struct {
9-
external Pointer<IntPtr> pact; //uintptr_t
5+
external Pointer<Uint16> pact_ref;
106
}
117

12-
class InteractionHandle extends Struct {
13-
external Pointer<Utf8> pact; // usize
14-
external Pointer<Utf8> interaction; // usize
8+
/// https://docs.rs/pact_ffi/latest/pact_ffi/mock_server/handles/struct.MessagePactHandle.html
9+
class MessagePactHandle extends Struct {
10+
external Pointer<Uint16> pact_ref;
1511
}
1612

17-
class MessageHandle extends Struct {
18-
external Pointer<Utf8> pact; // usize
19-
external Pointer<Utf8> message; // usize
13+
/// https://docs.rs/pact_ffi/latest/pact_ffi/mock_server/handles/struct.InteractionHandle.html
14+
class InteractionHandle extends Struct {
15+
external Pointer<Uint32> interaction_ref;
2016
}
2117

22-
class MessagePactHandle extends Struct {
23-
external Pointer<Utf8> pact; // usize
18+
/// https://docs.rs/pact_ffi/latest/pact_ffi/mock_server/handles/struct.MessageHandle.html
19+
class MessageHandle extends Struct {
20+
external Pointer<Uint32> interaction_ref;
2421
}
2522

2623
enum InteractionPart {

lib/src/interaction.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ class Interaction {
99
late InteractionHandle interaction;
1010

1111
Interaction(PactHandle handle, String description) {
12-
final cDescription = description.toNativeUtf8();
13-
interaction = bindings.pactffi_new_interaction(handle, cDescription);
12+
final nativeDescription = description.toNativeUtf8();
13+
interaction = bindings.pactffi_new_interaction(handle, nativeDescription);
1414
}
1515

1616
Interaction given(String providerState, {Map<String, String>? params}) {

0 commit comments

Comments
 (0)