Skip to content

Commit

Permalink
Fix Dart api bridge layer and regenerate bridge
Browse files Browse the repository at this point in the history
Some rust features cannot be bridged to Dart at the moment. These include type aliases and slices.
  • Loading branch information
Dampfwalze committed Apr 11, 2024
1 parent b1c6963 commit ce2eb84
Show file tree
Hide file tree
Showing 11 changed files with 368 additions and 124 deletions.
19 changes: 15 additions & 4 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust/bindings/dart_vdd/Makefile.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tasks.generate]
install_crate = "flutter_rust_bridge_codegen@^2.0.0-dev.28"
install_crate = "flutter_rust_bridge_codegen@^2.0.0-dev.31"
script = '''
flutter_rust_bridge_codegen generate
'''
46 changes: 22 additions & 24 deletions rust/bindings/dart_vdd/lib/src/generated/api.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.28.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.31.

// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import

Expand Down Expand Up @@ -33,28 +33,28 @@ class VirtualDisplayDriver extends RustOpaque {
required List<Mode> modes,
dynamic hint}) =>
RustLib.instance.api.virtualDisplayDriverAddMonitor(
that: this,
name: name,
enabled: enabled,
modes: modes,
);
that: this, name: name, enabled: enabled, modes: modes, hint: hint);

factory VirtualDisplayDriver({String? pipeName, dynamic hint}) =>
RustLib.instance.api
.virtualDisplayDriverNew(pipeName: pipeName, hint: hint);

/// Push in-memory changes to driver.
Future<void> notify({dynamic hint}) =>
RustLib.instance.api.virtualDisplayDriverNotify(that: this, hint: hint);

/// Persist in-memory changes to user settings
Future<void> persist({dynamic hint}) =>
RustLib.instance.api.virtualDisplayDriverPersist(that: this, hint: hint);

/// Remove all monitors from the driver.
Future<void> removeAllMonitors({dynamic hint}) =>
RustLib.instance.api.virtualDisplayDriverRemoveAllMonitors(
that: this,
);
Future<void> removeAllMonitors({dynamic hint}) => RustLib.instance.api
.virtualDisplayDriverRemoveAllMonitors(that: this, hint: hint);

/// Remove monitors from the driver.
Future<void> removeMonitors({required List<int> ids, dynamic hint}) =>
RustLib.instance.api.virtualDisplayDriverRemoveMonitors(
that: this,
ids: ids,
);
RustLib.instance.api
.virtualDisplayDriverRemoveMonitors(that: this, ids: ids, hint: hint);

/// Set the state of the monitor with the provided ID.
///
Expand All @@ -66,21 +66,19 @@ class VirtualDisplayDriver extends RustOpaque {
List<Mode>? modes,
dynamic hint}) =>
RustLib.instance.api.virtualDisplayDriverSetMonitor(
that: this,
id: id,
enabled: enabled,
name: name,
modes: modes,
);
that: this,
id: id,
enabled: enabled,
name: name,
modes: modes,
hint: hint);

/// Set the state of the provided monitors.
///
/// Each monitor with a matching ID will be updated to the provided state.
Future<void> setMonitors({required List<Monitor> monitors, dynamic hint}) =>
RustLib.instance.api.virtualDisplayDriverSetMonitors(
that: this,
monitors: monitors,
);
that: this, monitors: monitors, hint: hint);

/// Get the current state of the driver.
Future<List<Monitor>> get state =>
Expand All @@ -95,7 +93,7 @@ class VirtualDisplayDriver extends RustOpaque {
/// current state of the driver.
///
/// After calling, will instantly emit the current state of the driver.
Stream<List<Monitor>> get stream =>
Future<Stream<List<Monitor>>> get stream =>
RustLib.instance.api.virtualDisplayDriverStream(
that: this,
);
Expand Down
Loading

0 comments on commit ce2eb84

Please sign in to comment.