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