1use crate::BundledAsset;
2use const_serialize::{ConstStr, SerializeConst};
3use const_serialize_08 as const_serialize;
4use serde::{Deserialize, Serialize};
5use std::hash::Hash;
6
7#[derive(Debug, Clone, Copy, PartialEq, Eq, SerializeConst)]
16#[repr(C, u8)]
17#[allow(clippy::large_enum_variant)]
18#[non_exhaustive]
19pub enum SymbolData {
20 Asset(BundledAsset),
22
23 AndroidArtifact(AndroidArtifactMetadata),
25
26 SwiftPackage(SwiftPackageMetadata),
28}
29
30#[repr(u8)]
32#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, SerializeConst)]
33pub enum Platform {
34 Android,
35 Ios,
36 Macos,
37}
38
39#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, SerializeConst)]
41pub struct PlatformFlags(u8);
42
43impl PlatformFlags {
44 pub const fn new() -> Self {
45 Self(0)
46 }
47}
48
49impl Default for PlatformFlags {
50 fn default() -> Self {
51 Self::new()
52 }
53}
54
55impl PlatformFlags {
56 pub const fn with_platform(mut self, platform: Platform) -> Self {
57 self.0 |= 1 << platform as u8;
58 self
59 }
60
61 pub const fn supports(&self, platform: Platform) -> bool {
62 (self.0 & (1 << platform as u8)) != 0
63 }
64
65 pub const fn all() -> Self {
66 Self(0b000111) }
68
69 pub const fn mobile() -> Self {
70 Self(0b000011) }
72}
73
74#[derive(Debug, Clone, PartialEq, Eq, Hash)]
76pub struct PlatformIdentifiers {
77 pub android: Option<ConstStr>,
78 pub ios: Option<ConstStr>,
79 pub macos: Option<ConstStr>,
80}
81
82#[derive(Debug, Clone, Copy, PartialEq, Eq, SerializeConst, Serialize, Deserialize)]
84pub struct AndroidArtifactMetadata {
85 pub plugin_name: ConstStr,
86 pub artifact_path: ConstStr,
87 pub gradle_dependencies: ConstStr,
88}
89
90impl AndroidArtifactMetadata {
91 pub const fn new(
92 plugin_name: &'static str,
93 artifact_path: &'static str,
94 gradle_dependencies: &'static str,
95 ) -> Self {
96 Self {
97 plugin_name: ConstStr::new(plugin_name),
98 artifact_path: ConstStr::new(artifact_path),
99 gradle_dependencies: ConstStr::new(gradle_dependencies),
100 }
101 }
102}
103
104#[derive(Debug, Clone, Copy, PartialEq, Eq, SerializeConst, Serialize, Deserialize)]
106pub struct SwiftPackageMetadata {
107 pub plugin_name: ConstStr,
108 pub package_path: ConstStr,
109 pub product: ConstStr,
110}
111
112impl SwiftPackageMetadata {
113 pub const fn new(
114 plugin_name: &'static str,
115 package_path: &'static str,
116 product: &'static str,
117 ) -> Self {
118 Self {
119 plugin_name: ConstStr::new(plugin_name),
120 package_path: ConstStr::new(package_path),
121 product: ConstStr::new(product),
122 }
123 }
124}