workaround for code generator bug

This commit is contained in:
John Smith 2022-02-01 20:22:01 -05:00
parent 4bfa72f2db
commit ece93a21e7
9 changed files with 1159 additions and 906 deletions

View File

@ -26,7 +26,11 @@ impl ApiLogger {
loop { loop {
match rx.recv().await { match rx.recv().await {
Ok(v) => { Ok(v) => {
(update_callback)(VeilidUpdate::Log(v.0, v.1)).await; (update_callback)(VeilidUpdate::Log {
log_level: v.0,
message: v.1,
})
.await;
} }
Err(_) => { Err(_) => {
// Nothing to be done here... // Nothing to be done here...

View File

@ -1,5 +1,5 @@
#[cfg(target_os = "android")] #[cfg(target_os = "android")]
pub mod android; pub mod android;
#[cfg(target_os = "ios")] #[cfg(all(target_os = "ios", feature = "ios_tests"))]
pub mod ios_test_setup; pub mod ios_test_setup;
pub mod network_interfaces; pub mod network_interfaces;

View File

@ -130,7 +130,10 @@ impl VeilidLogLevel {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum VeilidUpdate { pub enum VeilidUpdate {
Log(VeilidLogLevel, String), Log {
log_level: VeilidLogLevel,
message: String,
},
Attachment(AttachmentState), Attachment(AttachmentState),
} }
@ -1167,7 +1170,10 @@ impl VeilidAPI {
timeout_ms: Option<u32>, timeout_ms: Option<u32>,
) -> Result<(), VeilidAPIError> { ) -> Result<(), VeilidAPIError> {
match update { match update {
VeilidUpdate::Log(_l, _s) => { VeilidUpdate::Log {
log_level: _,
message: _,
} => {
// No point in waiting for a log // No point in waiting for a log
} }
VeilidUpdate::Attachment(cs) => { VeilidUpdate::Attachment(cs) => {

View File

@ -1,458 +1,564 @@
// AUTO GENERATED FILE, DO NOT EDIT. // AUTO GENERATED FILE, DO NOT EDIT.
// Generated by `flutter_rust_bridge`. // Generated by `flutter_rust_bridge`.
// ignore_for_file: non_constant_identifier_names, unused_element, duplicate_ignore, directives_ordering, curly_braces_in_flow_control_structures, unnecessary_lambdas, slash_for_doc_comments, prefer_const_literals_to_create_immutables, implicit_dynamic_list_literal, duplicate_import, unused_import // ignore_for_file: non_constant_identifier_names, unused_element, duplicate_ignore, directives_ordering, curly_braces_in_flow_control_structures, unnecessary_lambdas, slash_for_doc_comments, prefer_const_literals_to_create_immutables, implicit_dynamic_list_literal, duplicate_import, unused_import
import 'dart:convert'; import 'dart:convert';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:freezed_annotation/freezed_annotation.dart';
import 'dart:convert'; import 'dart:convert';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:flutter_rust_bridge/flutter_rust_bridge.dart'; import 'package:flutter_rust_bridge/flutter_rust_bridge.dart';
import 'dart:ffi' as ffi; import 'dart:ffi' as ffi;
part 'bridge_generated.freezed.dart'; part 'bridge_generated.freezed.dart';
abstract class VeilidFlutter { abstract class VeilidFlutter {
Stream<VeilidUpdate> startupVeilidCore({ required VeilidConfig config,dynamic hint }); Stream<VeilidUpdate> startupVeilidCore(
{required VeilidConfig config, dynamic hint});
Future<VeilidState> getVeilidState({ dynamic hint }); Future<VeilidState> getVeilidState({dynamic hint});
Future<void> changeApiLogLevel({ required VeilidLogLevel logLevel,dynamic hint }); Future<void> changeApiLogLevel(
{required VeilidLogLevel logLevel, dynamic hint});
Future<void> shutdownVeilidCore({ dynamic hint }); Future<void> shutdownVeilidCore({dynamic hint});
Future<String> veilidVersionString({ dynamic hint }); Future<String> veilidVersionString({dynamic hint});
Future<VeilidVersion> veilidVersion({ dynamic hint }); Future<VeilidVersion> veilidVersion({dynamic hint});
} }
enum AttachmentState { enum AttachmentState {
Detached, Detached,
Attaching, Attaching,
AttachedWeak, AttachedWeak,
AttachedGood, AttachedGood,
AttachedStrong, AttachedStrong,
FullyAttached, FullyAttached,
OverAttached, OverAttached,
Detaching, Detaching,
} }
class VeilidConfig { class VeilidConfig {
final String programName; final String programName;
final String veilidNamespace; final String veilidNamespace;
final VeilidLogLevel apiLogLevel; final VeilidLogLevel apiLogLevel;
final bool capabilitiesProtocolUdp; final bool capabilitiesProtocolUdp;
final bool capabilitiesProtocolConnectTcp; final bool capabilitiesProtocolConnectTcp;
final bool capabilitiesProtocolAcceptTcp; final bool capabilitiesProtocolAcceptTcp;
final bool capabilitiesProtocolConnectWs; final bool capabilitiesProtocolConnectWs;
final bool capabilitiesProtocolAcceptWs; final bool capabilitiesProtocolAcceptWs;
final bool capabilitiesProtocolConnectWss; final bool capabilitiesProtocolConnectWss;
final bool capabilitiesProtocolAcceptWss; final bool capabilitiesProtocolAcceptWss;
final bool protectedStoreAllowInsecureFallback; final bool protectedStoreAllowInsecureFallback;
final bool protectedStoreAlwaysUseInsecureStorage; final bool protectedStoreAlwaysUseInsecureStorage;
final String protectedStoreInsecureFallbackDirectory; final String protectedStoreInsecureFallbackDirectory;
final bool protectedStoreDelete; final bool protectedStoreDelete;
final String tableStoreDirectory; final String tableStoreDirectory;
final bool tableStoreDelete; final bool tableStoreDelete;
final String blockStoreDirectory; final String blockStoreDirectory;
final bool blockStoreDelete; final bool blockStoreDelete;
final int networkMaxConnections; final int networkMaxConnections;
final int networkConnectionInitialTimeoutMs; final int networkConnectionInitialTimeoutMs;
final String networkNodeId; final String networkNodeId;
final String networkNodeIdSecret; final String networkNodeIdSecret;
final List<String> networkBootstrap; final List<String> networkBootstrap;
final bool networkUpnp; final bool networkUpnp;
final bool networkNatpmp; final bool networkNatpmp;
final bool networkEnableLocalPeerScope; final bool networkEnableLocalPeerScope;
final int networkRestrictedNatRetries; final int networkRestrictedNatRetries;
final int networkRpcConcurrency; final int networkRpcConcurrency;
final int networkRpcQueueSize; final int networkRpcQueueSize;
final int? networkRpcMaxTimestampBehindMs; final int? networkRpcMaxTimestampBehindMs;
final int? networkRpcMaxTimestampAheadMs; final int? networkRpcMaxTimestampAheadMs;
final int networkRpcTimeoutMs; final int networkRpcTimeoutMs;
final int networkRpcMaxRouteHopCount; final int networkRpcMaxRouteHopCount;
final int? networkDhtResolveNodeTimeoutMs; final int? networkDhtResolveNodeTimeoutMs;
final int networkDhtResolveNodeCount; final int networkDhtResolveNodeCount;
final int networkDhtResolveNodeFanout; final int networkDhtResolveNodeFanout;
final int networkDhtMaxFindNodeCount; final int networkDhtMaxFindNodeCount;
final int? networkDhtGetValueTimeoutMs; final int? networkDhtGetValueTimeoutMs;
final int networkDhtGetValueCount; final int networkDhtGetValueCount;
final int networkDhtGetValueFanout; final int networkDhtGetValueFanout;
final int? networkDhtSetValueTimeoutMs; final int? networkDhtSetValueTimeoutMs;
final int networkDhtSetValueCount; final int networkDhtSetValueCount;
final int networkDhtSetValueFanout; final int networkDhtSetValueFanout;
final int networkDhtMinPeerCount; final int networkDhtMinPeerCount;
final int networkDhtMinPeerRefreshTimeMs; final int networkDhtMinPeerRefreshTimeMs;
final int networkDhtValidateDialInfoReceiptTimeMs; final int networkDhtValidateDialInfoReceiptTimeMs;
final bool networkProtocolUdpEnabled; final bool networkProtocolUdpEnabled;
final int networkProtocolUdpSocketPoolSize; final int networkProtocolUdpSocketPoolSize;
final String networkProtocolUdpListenAddress; final String networkProtocolUdpListenAddress;
final String? networkProtocolUdpPublicAddress; final String? networkProtocolUdpPublicAddress;
final bool networkProtocolTcpConnect; final bool networkProtocolTcpConnect;
final bool networkProtocolTcpListen; final bool networkProtocolTcpListen;
final int networkProtocolTcpMaxConnections; final int networkProtocolTcpMaxConnections;
final String networkProtocolTcpListenAddress; final String networkProtocolTcpListenAddress;
final String? networkProtocolTcpPublicAddress; final String? networkProtocolTcpPublicAddress;
final bool networkProtocolWsConnect; final bool networkProtocolWsConnect;
final bool networkProtocolWsListen; final bool networkProtocolWsListen;
final int networkProtocolWsMaxConnections; final int networkProtocolWsMaxConnections;
final String networkProtocolWsListenAddress; final String networkProtocolWsListenAddress;
final String networkProtocolWsPath; final String networkProtocolWsPath;
final String? networkProtocolWsUrl; final String? networkProtocolWsUrl;
final bool networkProtocolWssConnect; final bool networkProtocolWssConnect;
final int networkProtocolWssMaxConnections; final int networkProtocolWssMaxConnections;
final int networkLeasesMaxServerSignalLeases; final int networkLeasesMaxServerSignalLeases;
final int networkLeasesMaxServerRelayLeases; final int networkLeasesMaxServerRelayLeases;
final int networkLeasesMaxClientSignalLeases; final int networkLeasesMaxClientSignalLeases;
final int networkLeasesMaxClientRelayLeases; final int networkLeasesMaxClientRelayLeases;
VeilidConfig({required this.programName,required this.veilidNamespace,required this.apiLogLevel,required this.capabilitiesProtocolUdp,required this.capabilitiesProtocolConnectTcp,required this.capabilitiesProtocolAcceptTcp,required this.capabilitiesProtocolConnectWs,required this.capabilitiesProtocolAcceptWs,required this.capabilitiesProtocolConnectWss,required this.capabilitiesProtocolAcceptWss,required this.protectedStoreAllowInsecureFallback,required this.protectedStoreAlwaysUseInsecureStorage,required this.protectedStoreInsecureFallbackDirectory,required this.protectedStoreDelete,required this.tableStoreDirectory,required this.tableStoreDelete,required this.blockStoreDirectory,required this.blockStoreDelete,required this.networkMaxConnections,required this.networkConnectionInitialTimeoutMs,required this.networkNodeId,required this.networkNodeIdSecret,required this.networkBootstrap,required this.networkUpnp,required this.networkNatpmp,required this.networkEnableLocalPeerScope,required this.networkRestrictedNatRetries,required this.networkRpcConcurrency,required this.networkRpcQueueSize,this.networkRpcMaxTimestampBehindMs,this.networkRpcMaxTimestampAheadMs,required this.networkRpcTimeoutMs,required this.networkRpcMaxRouteHopCount,this.networkDhtResolveNodeTimeoutMs,required this.networkDhtResolveNodeCount,required this.networkDhtResolveNodeFanout,required this.networkDhtMaxFindNodeCount,this.networkDhtGetValueTimeoutMs,required this.networkDhtGetValueCount,required this.networkDhtGetValueFanout,this.networkDhtSetValueTimeoutMs,required this.networkDhtSetValueCount,required this.networkDhtSetValueFanout,required this.networkDhtMinPeerCount,required this.networkDhtMinPeerRefreshTimeMs,required this.networkDhtValidateDialInfoReceiptTimeMs,required this.networkProtocolUdpEnabled,required this.networkProtocolUdpSocketPoolSize,required this.networkProtocolUdpListenAddress,this.networkProtocolUdpPublicAddress,required this.networkProtocolTcpConnect,required this.networkProtocolTcpListen,required this.networkProtocolTcpMaxConnections,required this.networkProtocolTcpListenAddress,this.networkProtocolTcpPublicAddress,required this.networkProtocolWsConnect,required this.networkProtocolWsListen,required this.networkProtocolWsMaxConnections,required this.networkProtocolWsListenAddress,required this.networkProtocolWsPath,this.networkProtocolWsUrl,required this.networkProtocolWssConnect,required this.networkProtocolWssMaxConnections,required this.networkLeasesMaxServerSignalLeases,required this.networkLeasesMaxServerRelayLeases,required this.networkLeasesMaxClientSignalLeases,required this.networkLeasesMaxClientRelayLeases,}); VeilidConfig({
} required this.programName,
required this.veilidNamespace,
required this.apiLogLevel,
required this.capabilitiesProtocolUdp,
required this.capabilitiesProtocolConnectTcp,
required this.capabilitiesProtocolAcceptTcp,
required this.capabilitiesProtocolConnectWs,
required this.capabilitiesProtocolAcceptWs,
required this.capabilitiesProtocolConnectWss,
required this.capabilitiesProtocolAcceptWss,
required this.protectedStoreAllowInsecureFallback,
required this.protectedStoreAlwaysUseInsecureStorage,
required this.protectedStoreInsecureFallbackDirectory,
required this.protectedStoreDelete,
required this.tableStoreDirectory,
required this.tableStoreDelete,
required this.blockStoreDirectory,
required this.blockStoreDelete,
required this.networkMaxConnections,
required this.networkConnectionInitialTimeoutMs,
required this.networkNodeId,
required this.networkNodeIdSecret,
required this.networkBootstrap,
required this.networkUpnp,
required this.networkNatpmp,
required this.networkEnableLocalPeerScope,
required this.networkRestrictedNatRetries,
required this.networkRpcConcurrency,
required this.networkRpcQueueSize,
this.networkRpcMaxTimestampBehindMs,
this.networkRpcMaxTimestampAheadMs,
required this.networkRpcTimeoutMs,
required this.networkRpcMaxRouteHopCount,
this.networkDhtResolveNodeTimeoutMs,
required this.networkDhtResolveNodeCount,
required this.networkDhtResolveNodeFanout,
required this.networkDhtMaxFindNodeCount,
this.networkDhtGetValueTimeoutMs,
required this.networkDhtGetValueCount,
required this.networkDhtGetValueFanout,
this.networkDhtSetValueTimeoutMs,
required this.networkDhtSetValueCount,
required this.networkDhtSetValueFanout,
required this.networkDhtMinPeerCount,
required this.networkDhtMinPeerRefreshTimeMs,
required this.networkDhtValidateDialInfoReceiptTimeMs,
required this.networkProtocolUdpEnabled,
required this.networkProtocolUdpSocketPoolSize,
required this.networkProtocolUdpListenAddress,
this.networkProtocolUdpPublicAddress,
required this.networkProtocolTcpConnect,
required this.networkProtocolTcpListen,
required this.networkProtocolTcpMaxConnections,
required this.networkProtocolTcpListenAddress,
this.networkProtocolTcpPublicAddress,
required this.networkProtocolWsConnect,
required this.networkProtocolWsListen,
required this.networkProtocolWsMaxConnections,
required this.networkProtocolWsListenAddress,
required this.networkProtocolWsPath,
this.networkProtocolWsUrl,
required this.networkProtocolWssConnect,
required this.networkProtocolWssMaxConnections,
required this.networkLeasesMaxServerSignalLeases,
required this.networkLeasesMaxServerRelayLeases,
required this.networkLeasesMaxClientSignalLeases,
required this.networkLeasesMaxClientRelayLeases,
});
}
enum VeilidLogLevel { enum VeilidLogLevel {
Error, Error,
Warn, Warn,
Info, Info,
Debug, Debug,
Trace, Trace,
} }
class VeilidState { class VeilidState {
final AttachmentState attachment; final AttachmentState attachment;
VeilidState({required this.attachment,}); VeilidState({
} required this.attachment,
});
}
@freezed @freezed
class VeilidUpdate with _$VeilidUpdate { class VeilidUpdate with _$VeilidUpdate {
const factory VeilidUpdate.log(VeilidLogLevel field0,,String field1,) = Log; const factory VeilidUpdate.log({
const factory VeilidUpdate.attachment(AttachmentState field0,) = Attachment; required VeilidLogLevel logLevel,
} required String message,
}) = Log;
const factory VeilidUpdate.attachment(
AttachmentState field0,
) = Attachment;
}
class VeilidVersion { class VeilidVersion {
final int major; final int major;
final int minor; final int minor;
final int patch; final int patch;
VeilidVersion({required this.major,required this.minor,required this.patch,}); VeilidVersion({
} required this.major,
required this.minor,
required this.patch,
});
}
class VeilidFlutterImpl extends FlutterRustBridgeBase<VeilidFlutterWire> implements VeilidFlutter { class VeilidFlutterImpl extends FlutterRustBridgeBase<VeilidFlutterWire>
factory VeilidFlutterImpl(ffi.DynamicLibrary dylib) => VeilidFlutterImpl.raw(VeilidFlutterWire(dylib)); implements VeilidFlutter {
factory VeilidFlutterImpl(ffi.DynamicLibrary dylib) =>
VeilidFlutterImpl.raw(VeilidFlutterWire(dylib));
VeilidFlutterImpl.raw(VeilidFlutterWire inner) : super(inner); VeilidFlutterImpl.raw(VeilidFlutterWire inner) : super(inner);
Stream<VeilidUpdate> startupVeilidCore({ required VeilidConfig config,dynamic hint }) => executeStream(FlutterRustBridgeTask( Stream<VeilidUpdate> startupVeilidCore(
callFfi: (port_) => inner.wire_startup_veilid_core(port_, _api2wire_box_autoadd_veilid_config(config)), {required VeilidConfig config, dynamic hint}) =>
parseSuccessData: _wire2api_veilid_update, executeStream(FlutterRustBridgeTask(
callFfi: (port_) => inner.wire_startup_veilid_core(
port_, _api2wire_box_autoadd_veilid_config(config)),
parseSuccessData: _wire2api_veilid_update,
constMeta: const FlutterRustBridgeTaskConstMeta( constMeta: const FlutterRustBridgeTaskConstMeta(
debugName: "startup_veilid_core", debugName: "startup_veilid_core",
argNames: ["config"], argNames: ["config"],
), ),
argValues: [config], argValues: [config],
hint: hint, hint: hint,
));
));
Future<VeilidState> getVeilidState({ dynamic hint }) => executeNormal(FlutterRustBridgeTask( Future<VeilidState> getVeilidState({dynamic hint}) =>
callFfi: (port_) => inner.wire_get_veilid_state(port_), executeNormal(FlutterRustBridgeTask(
parseSuccessData: _wire2api_veilid_state, callFfi: (port_) => inner.wire_get_veilid_state(port_),
parseSuccessData: _wire2api_veilid_state,
constMeta: const FlutterRustBridgeTaskConstMeta( constMeta: const FlutterRustBridgeTaskConstMeta(
debugName: "get_veilid_state", debugName: "get_veilid_state",
argNames: [], argNames: [],
), ),
argValues: [], argValues: [],
hint: hint, hint: hint,
));
));
Future<void> changeApiLogLevel({ required VeilidLogLevel logLevel,dynamic hint }) => executeNormal(FlutterRustBridgeTask( Future<void> changeApiLogLevel(
callFfi: (port_) => inner.wire_change_api_log_level(port_, _api2wire_veilid_log_level(logLevel)), {required VeilidLogLevel logLevel, dynamic hint}) =>
parseSuccessData: _wire2api_unit, executeNormal(FlutterRustBridgeTask(
callFfi: (port_) => inner.wire_change_api_log_level(
port_, _api2wire_veilid_log_level(logLevel)),
parseSuccessData: _wire2api_unit,
constMeta: const FlutterRustBridgeTaskConstMeta( constMeta: const FlutterRustBridgeTaskConstMeta(
debugName: "change_api_log_level", debugName: "change_api_log_level",
argNames: ["logLevel"], argNames: ["logLevel"],
), ),
argValues: [logLevel], argValues: [logLevel],
hint: hint, hint: hint,
));
));
Future<void> shutdownVeilidCore({ dynamic hint }) => executeNormal(FlutterRustBridgeTask( Future<void> shutdownVeilidCore({dynamic hint}) =>
callFfi: (port_) => inner.wire_shutdown_veilid_core(port_), executeNormal(FlutterRustBridgeTask(
parseSuccessData: _wire2api_unit, callFfi: (port_) => inner.wire_shutdown_veilid_core(port_),
parseSuccessData: _wire2api_unit,
constMeta: const FlutterRustBridgeTaskConstMeta( constMeta: const FlutterRustBridgeTaskConstMeta(
debugName: "shutdown_veilid_core", debugName: "shutdown_veilid_core",
argNames: [], argNames: [],
), ),
argValues: [], argValues: [],
hint: hint, hint: hint,
));
));
Future<String> veilidVersionString({ dynamic hint }) => executeNormal(FlutterRustBridgeTask( Future<String> veilidVersionString({dynamic hint}) =>
callFfi: (port_) => inner.wire_veilid_version_string(port_), executeNormal(FlutterRustBridgeTask(
parseSuccessData: _wire2api_String, callFfi: (port_) => inner.wire_veilid_version_string(port_),
parseSuccessData: _wire2api_String,
constMeta: const FlutterRustBridgeTaskConstMeta( constMeta: const FlutterRustBridgeTaskConstMeta(
debugName: "veilid_version_string", debugName: "veilid_version_string",
argNames: [], argNames: [],
), ),
argValues: [], argValues: [],
hint: hint, hint: hint,
));
));
Future<VeilidVersion> veilidVersion({ dynamic hint }) => executeNormal(FlutterRustBridgeTask( Future<VeilidVersion> veilidVersion({dynamic hint}) =>
callFfi: (port_) => inner.wire_veilid_version(port_), executeNormal(FlutterRustBridgeTask(
parseSuccessData: _wire2api_veilid_version, callFfi: (port_) => inner.wire_veilid_version(port_),
parseSuccessData: _wire2api_veilid_version,
constMeta: const FlutterRustBridgeTaskConstMeta( constMeta: const FlutterRustBridgeTaskConstMeta(
debugName: "veilid_version", debugName: "veilid_version",
argNames: [], argNames: [],
), ),
argValues: [], argValues: [],
hint: hint, hint: hint,
));
));
// Section: api2wire // Section: api2wire
ffi.Pointer<wire_uint_8_list> _api2wire_String(String raw) { ffi.Pointer<wire_uint_8_list> _api2wire_String(String raw) {
return _api2wire_uint_8_list(utf8.encoder.convert(raw)); return _api2wire_uint_8_list(utf8.encoder.convert(raw));
} }
ffi.Pointer<wire_StringList> _api2wire_StringList(List<String> raw) { ffi.Pointer<wire_StringList> _api2wire_StringList(List<String> raw) {
final ans = inner.new_StringList(raw.length); final ans = inner.new_StringList(raw.length);
for (var i = 0; i < raw.length; i++) { for (var i = 0; i < raw.length; i++) {
ans.ref.ptr[i] = _api2wire_String(raw[i]); ans.ref.ptr[i] = _api2wire_String(raw[i]);
} }
return ans; return ans;
} }
int _api2wire_bool(bool raw) { int _api2wire_bool(bool raw) {
return raw ? 1 : 0; return raw ? 1 : 0;
} }
ffi.Pointer<ffi.Uint32> _api2wire_box_autoadd_u32(int raw) { ffi.Pointer<ffi.Uint32> _api2wire_box_autoadd_u32(int raw) {
return inner.new_box_autoadd_u32(raw); return inner.new_box_autoadd_u32(raw);
} }
ffi.Pointer<wire_VeilidConfig> _api2wire_box_autoadd_veilid_config(VeilidConfig raw) { ffi.Pointer<wire_VeilidConfig> _api2wire_box_autoadd_veilid_config(
final ptr = inner.new_box_autoadd_veilid_config(); VeilidConfig raw) {
_api_fill_to_wire_veilid_config(raw, ptr.ref); final ptr = inner.new_box_autoadd_veilid_config();
return ptr; _api_fill_to_wire_veilid_config(raw, ptr.ref);
} return ptr;
}
ffi.Pointer<wire_uint_8_list> _api2wire_opt_String(String? raw) { ffi.Pointer<wire_uint_8_list> _api2wire_opt_String(String? raw) {
return raw == null ? ffi.nullptr : _api2wire_String(raw); return raw == null ? ffi.nullptr : _api2wire_String(raw);
} }
ffi.Pointer<ffi.Uint32> _api2wire_opt_box_autoadd_u32(int? raw) { ffi.Pointer<ffi.Uint32> _api2wire_opt_box_autoadd_u32(int? raw) {
return raw == null ? ffi.nullptr : _api2wire_box_autoadd_u32(raw); return raw == null ? ffi.nullptr : _api2wire_box_autoadd_u32(raw);
} }
int _api2wire_u32(int raw) { int _api2wire_u32(int raw) {
return raw; return raw;
} }
int _api2wire_u8(int raw) { int _api2wire_u8(int raw) {
return raw; return raw;
} }
ffi.Pointer<wire_uint_8_list> _api2wire_uint_8_list(Uint8List raw) { ffi.Pointer<wire_uint_8_list> _api2wire_uint_8_list(Uint8List raw) {
final ans = inner.new_uint_8_list(raw.length); final ans = inner.new_uint_8_list(raw.length);
ans.ref.ptr.asTypedList(raw.length).setAll(0, raw); ans.ref.ptr.asTypedList(raw.length).setAll(0, raw);
return ans; return ans;
} }
int _api2wire_veilid_log_level(VeilidLogLevel raw) {
return raw.index;
}
// Section: api_fill_to_wire
int _api2wire_veilid_log_level(VeilidLogLevel raw) { void _api_fill_to_wire_box_autoadd_veilid_config(
return raw.index; VeilidConfig apiObj, ffi.Pointer<wire_VeilidConfig> wireObj) {
} _api_fill_to_wire_veilid_config(apiObj, wireObj.ref);
}
// Section: api_fill_to_wire void _api_fill_to_wire_veilid_config(
VeilidConfig apiObj, wire_VeilidConfig wireObj) {
wireObj.program_name = _api2wire_String(apiObj.programName);
wireObj.veilid_namespace = _api2wire_String(apiObj.veilidNamespace);
wireObj.api_log_level = _api2wire_veilid_log_level(apiObj.apiLogLevel);
wireObj.capabilities__protocol_udp =
_api2wire_bool(apiObj.capabilitiesProtocolUdp);
wireObj.capabilities__protocol_connect_tcp =
_api2wire_bool(apiObj.capabilitiesProtocolConnectTcp);
wireObj.capabilities__protocol_accept_tcp =
_api2wire_bool(apiObj.capabilitiesProtocolAcceptTcp);
wireObj.capabilities__protocol_connect_ws =
_api2wire_bool(apiObj.capabilitiesProtocolConnectWs);
wireObj.capabilities__protocol_accept_ws =
_api2wire_bool(apiObj.capabilitiesProtocolAcceptWs);
wireObj.capabilities__protocol_connect_wss =
_api2wire_bool(apiObj.capabilitiesProtocolConnectWss);
wireObj.capabilities__protocol_accept_wss =
_api2wire_bool(apiObj.capabilitiesProtocolAcceptWss);
wireObj.protected_store__allow_insecure_fallback =
_api2wire_bool(apiObj.protectedStoreAllowInsecureFallback);
wireObj.protected_store__always_use_insecure_storage =
_api2wire_bool(apiObj.protectedStoreAlwaysUseInsecureStorage);
wireObj.protected_store__insecure_fallback_directory =
_api2wire_String(apiObj.protectedStoreInsecureFallbackDirectory);
wireObj.protected_store__delete =
_api2wire_bool(apiObj.protectedStoreDelete);
wireObj.table_store__directory =
_api2wire_String(apiObj.tableStoreDirectory);
wireObj.table_store__delete = _api2wire_bool(apiObj.tableStoreDelete);
wireObj.block_store__directory =
_api2wire_String(apiObj.blockStoreDirectory);
wireObj.block_store__delete = _api2wire_bool(apiObj.blockStoreDelete);
wireObj.network__max_connections =
_api2wire_u32(apiObj.networkMaxConnections);
wireObj.network__connection_initial_timeout_ms =
_api2wire_u32(apiObj.networkConnectionInitialTimeoutMs);
wireObj.network__node_id = _api2wire_String(apiObj.networkNodeId);
wireObj.network__node_id_secret =
_api2wire_String(apiObj.networkNodeIdSecret);
wireObj.network__bootstrap = _api2wire_StringList(apiObj.networkBootstrap);
wireObj.network__upnp = _api2wire_bool(apiObj.networkUpnp);
wireObj.network__natpmp = _api2wire_bool(apiObj.networkNatpmp);
wireObj.network__enable_local_peer_scope =
_api2wire_bool(apiObj.networkEnableLocalPeerScope);
wireObj.network__restricted_nat_retries =
_api2wire_u32(apiObj.networkRestrictedNatRetries);
wireObj.network__rpc__concurrency =
_api2wire_u32(apiObj.networkRpcConcurrency);
wireObj.network__rpc__queue_size =
_api2wire_u32(apiObj.networkRpcQueueSize);
wireObj.network__rpc__max_timestamp_behind_ms =
_api2wire_opt_box_autoadd_u32(apiObj.networkRpcMaxTimestampBehindMs);
wireObj.network__rpc__max_timestamp_ahead_ms =
_api2wire_opt_box_autoadd_u32(apiObj.networkRpcMaxTimestampAheadMs);
wireObj.network__rpc__timeout_ms =
_api2wire_u32(apiObj.networkRpcTimeoutMs);
wireObj.network__rpc__max_route_hop_count =
_api2wire_u8(apiObj.networkRpcMaxRouteHopCount);
wireObj.network__dht__resolve_node_timeout_ms =
_api2wire_opt_box_autoadd_u32(apiObj.networkDhtResolveNodeTimeoutMs);
wireObj.network__dht__resolve_node_count =
_api2wire_u32(apiObj.networkDhtResolveNodeCount);
wireObj.network__dht__resolve_node_fanout =
_api2wire_u32(apiObj.networkDhtResolveNodeFanout);
wireObj.network__dht__max_find_node_count =
_api2wire_u32(apiObj.networkDhtMaxFindNodeCount);
wireObj.network__dht__get_value_timeout_ms =
_api2wire_opt_box_autoadd_u32(apiObj.networkDhtGetValueTimeoutMs);
wireObj.network__dht__get_value_count =
_api2wire_u32(apiObj.networkDhtGetValueCount);
wireObj.network__dht__get_value_fanout =
_api2wire_u32(apiObj.networkDhtGetValueFanout);
wireObj.network__dht__set_value_timeout_ms =
_api2wire_opt_box_autoadd_u32(apiObj.networkDhtSetValueTimeoutMs);
wireObj.network__dht__set_value_count =
_api2wire_u32(apiObj.networkDhtSetValueCount);
wireObj.network__dht__set_value_fanout =
_api2wire_u32(apiObj.networkDhtSetValueFanout);
wireObj.network__dht__min_peer_count =
_api2wire_u32(apiObj.networkDhtMinPeerCount);
wireObj.network__dht__min_peer_refresh_time_ms =
_api2wire_u32(apiObj.networkDhtMinPeerRefreshTimeMs);
wireObj.network__dht__validate_dial_info_receipt_time_ms =
_api2wire_u32(apiObj.networkDhtValidateDialInfoReceiptTimeMs);
wireObj.network__protocol__udp__enabled =
_api2wire_bool(apiObj.networkProtocolUdpEnabled);
wireObj.network__protocol__udp__socket_pool_size =
_api2wire_u32(apiObj.networkProtocolUdpSocketPoolSize);
wireObj.network__protocol__udp__listen_address =
_api2wire_String(apiObj.networkProtocolUdpListenAddress);
wireObj.network__protocol__udp__public_address =
_api2wire_opt_String(apiObj.networkProtocolUdpPublicAddress);
wireObj.network__protocol__tcp__connect =
_api2wire_bool(apiObj.networkProtocolTcpConnect);
wireObj.network__protocol__tcp__listen =
_api2wire_bool(apiObj.networkProtocolTcpListen);
wireObj.network__protocol__tcp__max_connections =
_api2wire_u32(apiObj.networkProtocolTcpMaxConnections);
wireObj.network__protocol__tcp__listen_address =
_api2wire_String(apiObj.networkProtocolTcpListenAddress);
wireObj.network__protocol__tcp__public_address =
_api2wire_opt_String(apiObj.networkProtocolTcpPublicAddress);
wireObj.network__protocol__ws__connect =
_api2wire_bool(apiObj.networkProtocolWsConnect);
wireObj.network__protocol__ws__listen =
_api2wire_bool(apiObj.networkProtocolWsListen);
wireObj.network__protocol__ws__max_connections =
_api2wire_u32(apiObj.networkProtocolWsMaxConnections);
wireObj.network__protocol__ws__listen_address =
_api2wire_String(apiObj.networkProtocolWsListenAddress);
wireObj.network__protocol__ws__path =
_api2wire_String(apiObj.networkProtocolWsPath);
wireObj.network__protocol__ws__url =
_api2wire_opt_String(apiObj.networkProtocolWsUrl);
wireObj.network__protocol__wss__connect =
_api2wire_bool(apiObj.networkProtocolWssConnect);
wireObj.network__protocol__wss__max_connections =
_api2wire_u32(apiObj.networkProtocolWssMaxConnections);
wireObj.network__leases__max_server_signal_leases =
_api2wire_u32(apiObj.networkLeasesMaxServerSignalLeases);
wireObj.network__leases__max_server_relay_leases =
_api2wire_u32(apiObj.networkLeasesMaxServerRelayLeases);
wireObj.network__leases__max_client_signal_leases =
_api2wire_u32(apiObj.networkLeasesMaxClientSignalLeases);
wireObj.network__leases__max_client_relay_leases =
_api2wire_u32(apiObj.networkLeasesMaxClientRelayLeases);
}
}
// Section: wire2api
String _wire2api_String(dynamic raw) {
return raw as String;
}
void _api_fill_to_wire_box_autoadd_veilid_config(VeilidConfig apiObj, ffi.Pointer<wire_VeilidConfig> wireObj) {
_api_fill_to_wire_veilid_config(apiObj, wireObj.ref);
}
void _api_fill_to_wire_veilid_config(VeilidConfig apiObj, wire_VeilidConfig wireObj) {
wireObj.program_name = _api2wire_String(apiObj.programName);
wireObj.veilid_namespace = _api2wire_String(apiObj.veilidNamespace);
wireObj.api_log_level = _api2wire_veilid_log_level(apiObj.apiLogLevel);
wireObj.capabilities__protocol_udp = _api2wire_bool(apiObj.capabilitiesProtocolUdp);
wireObj.capabilities__protocol_connect_tcp = _api2wire_bool(apiObj.capabilitiesProtocolConnectTcp);
wireObj.capabilities__protocol_accept_tcp = _api2wire_bool(apiObj.capabilitiesProtocolAcceptTcp);
wireObj.capabilities__protocol_connect_ws = _api2wire_bool(apiObj.capabilitiesProtocolConnectWs);
wireObj.capabilities__protocol_accept_ws = _api2wire_bool(apiObj.capabilitiesProtocolAcceptWs);
wireObj.capabilities__protocol_connect_wss = _api2wire_bool(apiObj.capabilitiesProtocolConnectWss);
wireObj.capabilities__protocol_accept_wss = _api2wire_bool(apiObj.capabilitiesProtocolAcceptWss);
wireObj.protected_store__allow_insecure_fallback = _api2wire_bool(apiObj.protectedStoreAllowInsecureFallback);
wireObj.protected_store__always_use_insecure_storage = _api2wire_bool(apiObj.protectedStoreAlwaysUseInsecureStorage);
wireObj.protected_store__insecure_fallback_directory = _api2wire_String(apiObj.protectedStoreInsecureFallbackDirectory);
wireObj.protected_store__delete = _api2wire_bool(apiObj.protectedStoreDelete);
wireObj.table_store__directory = _api2wire_String(apiObj.tableStoreDirectory);
wireObj.table_store__delete = _api2wire_bool(apiObj.tableStoreDelete);
wireObj.block_store__directory = _api2wire_String(apiObj.blockStoreDirectory);
wireObj.block_store__delete = _api2wire_bool(apiObj.blockStoreDelete);
wireObj.network__max_connections = _api2wire_u32(apiObj.networkMaxConnections);
wireObj.network__connection_initial_timeout_ms = _api2wire_u32(apiObj.networkConnectionInitialTimeoutMs);
wireObj.network__node_id = _api2wire_String(apiObj.networkNodeId);
wireObj.network__node_id_secret = _api2wire_String(apiObj.networkNodeIdSecret);
wireObj.network__bootstrap = _api2wire_StringList(apiObj.networkBootstrap);
wireObj.network__upnp = _api2wire_bool(apiObj.networkUpnp);
wireObj.network__natpmp = _api2wire_bool(apiObj.networkNatpmp);
wireObj.network__enable_local_peer_scope = _api2wire_bool(apiObj.networkEnableLocalPeerScope);
wireObj.network__restricted_nat_retries = _api2wire_u32(apiObj.networkRestrictedNatRetries);
wireObj.network__rpc__concurrency = _api2wire_u32(apiObj.networkRpcConcurrency);
wireObj.network__rpc__queue_size = _api2wire_u32(apiObj.networkRpcQueueSize);
wireObj.network__rpc__max_timestamp_behind_ms = _api2wire_opt_box_autoadd_u32(apiObj.networkRpcMaxTimestampBehindMs);
wireObj.network__rpc__max_timestamp_ahead_ms = _api2wire_opt_box_autoadd_u32(apiObj.networkRpcMaxTimestampAheadMs);
wireObj.network__rpc__timeout_ms = _api2wire_u32(apiObj.networkRpcTimeoutMs);
wireObj.network__rpc__max_route_hop_count = _api2wire_u8(apiObj.networkRpcMaxRouteHopCount);
wireObj.network__dht__resolve_node_timeout_ms = _api2wire_opt_box_autoadd_u32(apiObj.networkDhtResolveNodeTimeoutMs);
wireObj.network__dht__resolve_node_count = _api2wire_u32(apiObj.networkDhtResolveNodeCount);
wireObj.network__dht__resolve_node_fanout = _api2wire_u32(apiObj.networkDhtResolveNodeFanout);
wireObj.network__dht__max_find_node_count = _api2wire_u32(apiObj.networkDhtMaxFindNodeCount);
wireObj.network__dht__get_value_timeout_ms = _api2wire_opt_box_autoadd_u32(apiObj.networkDhtGetValueTimeoutMs);
wireObj.network__dht__get_value_count = _api2wire_u32(apiObj.networkDhtGetValueCount);
wireObj.network__dht__get_value_fanout = _api2wire_u32(apiObj.networkDhtGetValueFanout);
wireObj.network__dht__set_value_timeout_ms = _api2wire_opt_box_autoadd_u32(apiObj.networkDhtSetValueTimeoutMs);
wireObj.network__dht__set_value_count = _api2wire_u32(apiObj.networkDhtSetValueCount);
wireObj.network__dht__set_value_fanout = _api2wire_u32(apiObj.networkDhtSetValueFanout);
wireObj.network__dht__min_peer_count = _api2wire_u32(apiObj.networkDhtMinPeerCount);
wireObj.network__dht__min_peer_refresh_time_ms = _api2wire_u32(apiObj.networkDhtMinPeerRefreshTimeMs);
wireObj.network__dht__validate_dial_info_receipt_time_ms = _api2wire_u32(apiObj.networkDhtValidateDialInfoReceiptTimeMs);
wireObj.network__protocol__udp__enabled = _api2wire_bool(apiObj.networkProtocolUdpEnabled);
wireObj.network__protocol__udp__socket_pool_size = _api2wire_u32(apiObj.networkProtocolUdpSocketPoolSize);
wireObj.network__protocol__udp__listen_address = _api2wire_String(apiObj.networkProtocolUdpListenAddress);
wireObj.network__protocol__udp__public_address = _api2wire_opt_String(apiObj.networkProtocolUdpPublicAddress);
wireObj.network__protocol__tcp__connect = _api2wire_bool(apiObj.networkProtocolTcpConnect);
wireObj.network__protocol__tcp__listen = _api2wire_bool(apiObj.networkProtocolTcpListen);
wireObj.network__protocol__tcp__max_connections = _api2wire_u32(apiObj.networkProtocolTcpMaxConnections);
wireObj.network__protocol__tcp__listen_address = _api2wire_String(apiObj.networkProtocolTcpListenAddress);
wireObj.network__protocol__tcp__public_address = _api2wire_opt_String(apiObj.networkProtocolTcpPublicAddress);
wireObj.network__protocol__ws__connect = _api2wire_bool(apiObj.networkProtocolWsConnect);
wireObj.network__protocol__ws__listen = _api2wire_bool(apiObj.networkProtocolWsListen);
wireObj.network__protocol__ws__max_connections = _api2wire_u32(apiObj.networkProtocolWsMaxConnections);
wireObj.network__protocol__ws__listen_address = _api2wire_String(apiObj.networkProtocolWsListenAddress);
wireObj.network__protocol__ws__path = _api2wire_String(apiObj.networkProtocolWsPath);
wireObj.network__protocol__ws__url = _api2wire_opt_String(apiObj.networkProtocolWsUrl);
wireObj.network__protocol__wss__connect = _api2wire_bool(apiObj.networkProtocolWssConnect);
wireObj.network__protocol__wss__max_connections = _api2wire_u32(apiObj.networkProtocolWssMaxConnections);
wireObj.network__leases__max_server_signal_leases = _api2wire_u32(apiObj.networkLeasesMaxServerSignalLeases);
wireObj.network__leases__max_server_relay_leases = _api2wire_u32(apiObj.networkLeasesMaxServerRelayLeases);
wireObj.network__leases__max_client_signal_leases = _api2wire_u32(apiObj.networkLeasesMaxClientSignalLeases);
wireObj.network__leases__max_client_relay_leases = _api2wire_u32(apiObj.networkLeasesMaxClientRelayLeases);
}
}
// Section: wire2api
String _wire2api_String(dynamic raw) {
return raw as String;
}
AttachmentState _wire2api_attachment_state(dynamic raw) { AttachmentState _wire2api_attachment_state(dynamic raw) {
return AttachmentState.values[raw]; return AttachmentState.values[raw];
} }
int _wire2api_u32(dynamic raw) { int _wire2api_u32(dynamic raw) {
return raw as int; return raw as int;
} }
int _wire2api_u8(dynamic raw) { int _wire2api_u8(dynamic raw) {
return raw as int; return raw as int;
} }
Uint8List _wire2api_uint_8_list(dynamic raw) { Uint8List _wire2api_uint_8_list(dynamic raw) {
return raw as Uint8List; return raw as Uint8List;
} }
void _wire2api_unit(dynamic raw) { void _wire2api_unit(dynamic raw) {
return; return;
} }
VeilidLogLevel _wire2api_veilid_log_level(dynamic raw) { VeilidLogLevel _wire2api_veilid_log_level(dynamic raw) {
return VeilidLogLevel.values[raw]; return VeilidLogLevel.values[raw];
} }
VeilidState _wire2api_veilid_state(dynamic raw) { VeilidState _wire2api_veilid_state(dynamic raw) {
final arr = raw as List<dynamic>; final arr = raw as List<dynamic>;
if (arr.length != 1) throw Exception('unexpected arr length: expect 1 but see ${arr.length}'); if (arr.length != 1)
return VeilidState(attachment: _wire2api_attachment_state(arr[0]),); throw Exception('unexpected arr length: expect 1 but see ${arr.length}');
} return VeilidState(
attachment: _wire2api_attachment_state(arr[0]),
);
}
VeilidUpdate _wire2api_veilid_update(dynamic raw) { VeilidUpdate _wire2api_veilid_update(dynamic raw) {
switch (raw[0]) { switch (raw[0]) {
case 0: return Log(_wire2api_veilid_log_level(raw[1]),_wire2api_String(raw[2]),); case 0:
case 1: return Attachment(_wire2api_attachment_state(raw[1]),); return Log(
default: throw Exception("unreachable"); logLevel: _wire2api_veilid_log_level(raw[1]),
} message: _wire2api_String(raw[2]),
} );
case 1:
return Attachment(
_wire2api_attachment_state(raw[1]),
);
default:
throw Exception("unreachable");
}
}
VeilidVersion _wire2api_veilid_version(dynamic raw) { VeilidVersion _wire2api_veilid_version(dynamic raw) {
final arr = raw as List<dynamic>; final arr = raw as List<dynamic>;
if (arr.length != 3) throw Exception('unexpected arr length: expect 3 but see ${arr.length}'); if (arr.length != 3)
return VeilidVersion(major: _wire2api_u32(arr[0]), throw Exception('unexpected arr length: expect 3 but see ${arr.length}');
minor: _wire2api_u32(arr[1]), return VeilidVersion(
patch: _wire2api_u32(arr[2]),); major: _wire2api_u32(arr[0]),
} minor: _wire2api_u32(arr[1]),
patch: _wire2api_u32(arr[2]),
);
}
// ignore_for_file: camel_case_types, non_constant_identifier_names, avoid_positional_boolean_parameters, annotate_overrides, constant_identifier_names // ignore_for_file: camel_case_types, non_constant_identifier_names, avoid_positional_boolean_parameters, annotate_overrides, constant_identifier_names
// AUTO GENERATED FILE, DO NOT EDIT. // AUTO GENERATED FILE, DO NOT EDIT.
@ -844,8 +950,6 @@ class wire_VeilidConfig extends ffi.Struct {
external int network__leases__max_client_relay_leases; external int network__leases__max_client_relay_leases;
} }
typedef DartPostCObjectFnType = ffi.Pointer< typedef DartPostCObjectFnType = ffi.Pointer<
ffi.NativeFunction<ffi.Uint8 Function(DartPort, ffi.Pointer<ffi.Void>)>>; ffi.NativeFunction<ffi.Uint8 Function(DartPort, ffi.Pointer<ffi.Void>)>>;
typedef DartPort = ffi.Int64; typedef DartPort = ffi.Int64;

View File

@ -18,6 +18,13 @@ final _privateConstructorUsedError = UnsupportedError(
class _$VeilidUpdateTearOff { class _$VeilidUpdateTearOff {
const _$VeilidUpdateTearOff(); const _$VeilidUpdateTearOff();
Log log({required VeilidLogLevel logLevel, required String message}) {
return Log(
logLevel: logLevel,
message: message,
);
}
Attachment attachment(AttachmentState field0) { Attachment attachment(AttachmentState field0) {
return Attachment( return Attachment(
field0, field0,
@ -30,44 +37,44 @@ const $VeilidUpdate = _$VeilidUpdateTearOff();
/// @nodoc /// @nodoc
mixin _$VeilidUpdate { mixin _$VeilidUpdate {
AttachmentState get field0 => throw _privateConstructorUsedError;
@optionalTypeArgs @optionalTypeArgs
TResult when<TResult extends Object?>({ TResult when<TResult extends Object?>({
required TResult Function(VeilidLogLevel logLevel, String message) log,
required TResult Function(AttachmentState field0) attachment, required TResult Function(AttachmentState field0) attachment,
}) => }) =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
@optionalTypeArgs @optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({ TResult? whenOrNull<TResult extends Object?>({
TResult Function(VeilidLogLevel logLevel, String message)? log,
TResult Function(AttachmentState field0)? attachment, TResult Function(AttachmentState field0)? attachment,
}) => }) =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
@optionalTypeArgs @optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({ TResult maybeWhen<TResult extends Object?>({
TResult Function(VeilidLogLevel logLevel, String message)? log,
TResult Function(AttachmentState field0)? attachment, TResult Function(AttachmentState field0)? attachment,
required TResult orElse(), required TResult orElse(),
}) => }) =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
@optionalTypeArgs @optionalTypeArgs
TResult map<TResult extends Object?>({ TResult map<TResult extends Object?>({
required TResult Function(Log value) log,
required TResult Function(Attachment value) attachment, required TResult Function(Attachment value) attachment,
}) => }) =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
@optionalTypeArgs @optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({ TResult? mapOrNull<TResult extends Object?>({
TResult Function(Log value)? log,
TResult Function(Attachment value)? attachment, TResult Function(Attachment value)? attachment,
}) => }) =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
@optionalTypeArgs @optionalTypeArgs
TResult maybeMap<TResult extends Object?>({ TResult maybeMap<TResult extends Object?>({
TResult Function(Log value)? log,
TResult Function(Attachment value)? attachment, TResult Function(Attachment value)? attachment,
required TResult orElse(), required TResult orElse(),
}) => }) =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$VeilidUpdateCopyWith<VeilidUpdate> get copyWith =>
throw _privateConstructorUsedError;
} }
/// @nodoc /// @nodoc
@ -75,7 +82,6 @@ abstract class $VeilidUpdateCopyWith<$Res> {
factory $VeilidUpdateCopyWith( factory $VeilidUpdateCopyWith(
VeilidUpdate value, $Res Function(VeilidUpdate) then) = VeilidUpdate value, $Res Function(VeilidUpdate) then) =
_$VeilidUpdateCopyWithImpl<$Res>; _$VeilidUpdateCopyWithImpl<$Res>;
$Res call({AttachmentState field0});
} }
/// @nodoc /// @nodoc
@ -85,27 +91,154 @@ class _$VeilidUpdateCopyWithImpl<$Res> implements $VeilidUpdateCopyWith<$Res> {
final VeilidUpdate _value; final VeilidUpdate _value;
// ignore: unused_field // ignore: unused_field
final $Res Function(VeilidUpdate) _then; final $Res Function(VeilidUpdate) _then;
}
/// @nodoc
abstract class $LogCopyWith<$Res> {
factory $LogCopyWith(Log value, $Res Function(Log) then) =
_$LogCopyWithImpl<$Res>;
$Res call({VeilidLogLevel logLevel, String message});
}
/// @nodoc
class _$LogCopyWithImpl<$Res> extends _$VeilidUpdateCopyWithImpl<$Res>
implements $LogCopyWith<$Res> {
_$LogCopyWithImpl(Log _value, $Res Function(Log) _then)
: super(_value, (v) => _then(v as Log));
@override
Log get _value => super._value as Log;
@override @override
$Res call({ $Res call({
Object? field0 = freezed, Object? logLevel = freezed,
Object? message = freezed,
}) { }) {
return _then(_value.copyWith( return _then(Log(
field0: field0 == freezed logLevel: logLevel == freezed
? _value.field0 ? _value.logLevel
: field0 // ignore: cast_nullable_to_non_nullable : logLevel // ignore: cast_nullable_to_non_nullable
as AttachmentState, as VeilidLogLevel,
message: message == freezed
? _value.message
: message // ignore: cast_nullable_to_non_nullable
as String,
)); ));
} }
} }
/// @nodoc /// @nodoc
abstract class $AttachmentCopyWith<$Res>
implements $VeilidUpdateCopyWith<$Res> { class _$Log implements Log {
const _$Log({required this.logLevel, required this.message});
@override
final VeilidLogLevel logLevel;
@override
final String message;
@override
String toString() {
return 'VeilidUpdate.log(logLevel: $logLevel, message: $message)';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is Log &&
const DeepCollectionEquality().equals(other.logLevel, logLevel) &&
const DeepCollectionEquality().equals(other.message, message));
}
@override
int get hashCode => Object.hash(
runtimeType,
const DeepCollectionEquality().hash(logLevel),
const DeepCollectionEquality().hash(message));
@JsonKey(ignore: true)
@override
$LogCopyWith<Log> get copyWith => _$LogCopyWithImpl<Log>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(VeilidLogLevel logLevel, String message) log,
required TResult Function(AttachmentState field0) attachment,
}) {
return log(logLevel, message);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function(VeilidLogLevel logLevel, String message)? log,
TResult Function(AttachmentState field0)? attachment,
}) {
return log?.call(logLevel, message);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(VeilidLogLevel logLevel, String message)? log,
TResult Function(AttachmentState field0)? attachment,
required TResult orElse(),
}) {
if (log != null) {
return log(logLevel, message);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(Log value) log,
required TResult Function(Attachment value) attachment,
}) {
return log(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Log value)? log,
TResult Function(Attachment value)? attachment,
}) {
return log?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(Log value)? log,
TResult Function(Attachment value)? attachment,
required TResult orElse(),
}) {
if (log != null) {
return log(this);
}
return orElse();
}
}
abstract class Log implements VeilidUpdate {
const factory Log(
{required VeilidLogLevel logLevel, required String message}) = _$Log;
VeilidLogLevel get logLevel;
String get message;
@JsonKey(ignore: true)
$LogCopyWith<Log> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $AttachmentCopyWith<$Res> {
factory $AttachmentCopyWith( factory $AttachmentCopyWith(
Attachment value, $Res Function(Attachment) then) = Attachment value, $Res Function(Attachment) then) =
_$AttachmentCopyWithImpl<$Res>; _$AttachmentCopyWithImpl<$Res>;
@override
$Res call({AttachmentState field0}); $Res call({AttachmentState field0});
} }
@ -164,6 +297,7 @@ class _$Attachment implements Attachment {
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult when<TResult extends Object?>({ TResult when<TResult extends Object?>({
required TResult Function(VeilidLogLevel logLevel, String message) log,
required TResult Function(AttachmentState field0) attachment, required TResult Function(AttachmentState field0) attachment,
}) { }) {
return attachment(field0); return attachment(field0);
@ -172,6 +306,7 @@ class _$Attachment implements Attachment {
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({ TResult? whenOrNull<TResult extends Object?>({
TResult Function(VeilidLogLevel logLevel, String message)? log,
TResult Function(AttachmentState field0)? attachment, TResult Function(AttachmentState field0)? attachment,
}) { }) {
return attachment?.call(field0); return attachment?.call(field0);
@ -180,6 +315,7 @@ class _$Attachment implements Attachment {
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({ TResult maybeWhen<TResult extends Object?>({
TResult Function(VeilidLogLevel logLevel, String message)? log,
TResult Function(AttachmentState field0)? attachment, TResult Function(AttachmentState field0)? attachment,
required TResult orElse(), required TResult orElse(),
}) { }) {
@ -192,6 +328,7 @@ class _$Attachment implements Attachment {
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult map<TResult extends Object?>({ TResult map<TResult extends Object?>({
required TResult Function(Log value) log,
required TResult Function(Attachment value) attachment, required TResult Function(Attachment value) attachment,
}) { }) {
return attachment(this); return attachment(this);
@ -200,6 +337,7 @@ class _$Attachment implements Attachment {
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({ TResult? mapOrNull<TResult extends Object?>({
TResult Function(Log value)? log,
TResult Function(Attachment value)? attachment, TResult Function(Attachment value)? attachment,
}) { }) {
return attachment?.call(this); return attachment?.call(this);
@ -208,6 +346,7 @@ class _$Attachment implements Attachment {
@override @override
@optionalTypeArgs @optionalTypeArgs
TResult maybeMap<TResult extends Object?>({ TResult maybeMap<TResult extends Object?>({
TResult Function(Log value)? log,
TResult Function(Attachment value)? attachment, TResult Function(Attachment value)? attachment,
required TResult orElse(), required TResult orElse(),
}) { }) {
@ -221,9 +360,7 @@ class _$Attachment implements Attachment {
abstract class Attachment implements VeilidUpdate { abstract class Attachment implements VeilidUpdate {
const factory Attachment(AttachmentState field0) = _$Attachment; const factory Attachment(AttachmentState field0) = _$Attachment;
@override
AttachmentState get field0; AttachmentState get field0;
@override
@JsonKey(ignore: true) @JsonKey(ignore: true)
$AttachmentCopyWith<Attachment> get copyWith => $AttachmentCopyWith<Attachment> get copyWith =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;

View File

@ -22,7 +22,7 @@ class Veilid {
if (veilidApi == null) { if (veilidApi == null) {
throw PlatformException( throw PlatformException(
code: 'Library missing', code: 'Library missing',
details: 'veilid_core library could not be loaded dynamically', details: 'veilid_flutter library could not be loaded dynamically',
); );
} }
return veilidApi; return veilidApi;

View File

@ -92,6 +92,33 @@ fn main() {
.wait() .wait()
.expect("flutter_rust_bridge_codegen was not running"); .expect("flutter_rust_bridge_codegen was not running");
// Flutter pub get
// Run: flutter pub get
let mut command;
cfg_if! {
if #[cfg(target_os="windows")] {
command = Command::new("cmd");
command.args([
OsStr::new("/c"),
OsStr::new("flutter"),
OsStr::new("pub"),
OsStr::new("get"),
]);
} else {
command = Command::new("flutter");
command.args([
OsStr::new("pub"),
OsStr::new("get"),
]);
}
}
let mut child = command
.spawn()
.expect("'flutter pub get' did not execute correctly");
child.wait().expect("'flutter pub get' was not running");
// Build freezed // Build freezed
// Run: flutter pub run build_runner build // Run: flutter pub run build_runner build

View File

@ -468,14 +468,20 @@ impl VeilidLogLevel {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum VeilidUpdate { pub enum VeilidUpdate {
Log(VeilidLogLevel, String), Log {
log_level: VeilidLogLevel,
message: String,
},
Attachment(AttachmentState), Attachment(AttachmentState),
} }
impl VeilidUpdate { impl VeilidUpdate {
fn from_core(veilid_update: veilid_core::VeilidUpdate) -> Self { fn from_core(veilid_update: veilid_core::VeilidUpdate) -> Self {
match veilid_update { match veilid_update {
veilid_core::VeilidUpdate::Log(ll, s) => Self::Log(VeilidLogLevel::from_core(ll), s), veilid_core::VeilidUpdate::Log { log_level, message } => Self::Log {
log_level: VeilidLogLevel::from_core(log_level),
message,
},
veilid_core::VeilidUpdate::Attachment(attachment) => { veilid_core::VeilidUpdate::Attachment(attachment) => {
Self::Attachment(AttachmentState::from_core(attachment)) Self::Attachment(AttachmentState::from_core(attachment))
} }

File diff suppressed because one or more lines are too long