diff --git a/src/structs/forgemod.rs b/src/structs/forgemod.rs index 4fa8c5a..6c7e323 100644 --- a/src/structs/forgemod.rs +++ b/src/structs/forgemod.rs @@ -15,9 +15,9 @@ pub struct ForgeMod, + pub manifest: ForgeManifestSafe, - pub(crate) _inner: Inner, + pub data: Inner, #[serde(skip)] pub(crate) _marker: PhantomData, diff --git a/src/structs/manifest.rs b/src/structs/manifest.rs index ecac08e..641ced0 100644 --- a/src/structs/manifest.rs +++ b/src/structs/manifest.rs @@ -20,14 +20,14 @@ pub struct ForgeManifest { } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub(crate) struct ForgeManifestSafe { +pub struct ForgeManifestSafe { pub(crate) _id: String, - pub(crate) manifest_version: u32, + pub manifest_version: u32, #[serde(rename = "type")] - pub(crate) _type: String, + pub _type: String, // #[serde(flatten)] does not work with bincode - pub(crate) inner: Inner, + pub inner: Inner, #[serde(skip)] pub(crate) _marker: PhantomData, diff --git a/src/structs/v1.rs b/src/structs/v1.rs index da88634..f2e9626 100644 --- a/src/structs/v1.rs +++ b/src/structs/v1.rs @@ -37,91 +37,91 @@ mod manifest { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)] pub struct Dependency { - pub(super) name: String, - pub(super) version: VersionReq, + pub name: String, + pub version: VersionReq, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)] pub struct Include { - pub(super) bs_dest: PathBuf, - pub(super) local_src: PathBuf, + pub bs_dest: PathBuf, + pub local_src: PathBuf, } /// type: mod #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Mod { - pub(super) name: String, - pub(super) description: String, - pub(super) website: String, - pub(super) version: Version, - pub(super) game_version: VersionReq, - pub(super) category: String, + pub name: String, + pub description: String, + pub website: String, + pub version: Version, + pub game_version: VersionReq, + pub category: String, - pub(super) artifact: Option, // not actually optional - pub(super) includes: Vec, + pub artifact: Option, // not actually optional + pub includes: Vec, - pub(super) pre_exec: Option, - pub(super) post_exec: Option, + pub pre_exec: Option, + pub post_exec: Option, - pub(super) depends: Vec, - pub(super) conflicts: Vec, + pub depends: Vec, + pub conflicts: Vec, } /// type: module_parent #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Parent { - pub(super) name: String, - pub(super) description: String, - pub(super) website: String, - pub(super) version: Version, - pub(super) game_version: VersionReq, - pub(super) category: String, + pub name: String, + pub description: String, + pub website: String, + pub version: Version, + pub game_version: VersionReq, + pub category: String, - pub(super) pre_exec: Option, - pub(super) post_exec: Option, + pub pre_exec: Option, + pub post_exec: Option, - pub(super) depends: Vec, - pub(super) conflicts: Vec, + pub depends: Vec, + pub conflicts: Vec, - pub(super) modules: Vec, + pub modules: Vec, } /// type: module #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)] pub struct Module { - pub(super) name: String, + pub name: String, - pub(super) required: bool, - pub(super) suggested: bool, + pub required: bool, + pub suggested: bool, - pub(super) artifact: Option, // not actually optional - pub(super) includes: Vec, + pub artifact: Option, // not actually optional + pub includes: Vec, - pub(super) pre_exec: Option, - pub(super) post_exec: Option, + pub pre_exec: Option, + pub post_exec: Option, - pub(super) depends: Vec, - pub(super) conflicts: Vec, + pub depends: Vec, + pub conflicts: Vec, } /// type: lib #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Lib { - pub(super) name: String, - pub(super) description: String, - pub(super) website: String, - pub(super) version: Version, - pub(super) game_version: VersionReq, - pub(super) category: String, + pub name: String, + pub description: String, + pub website: String, + pub version: Version, + pub game_version: VersionReq, + pub category: String, - pub(super) artifact: Option, // not actually optional - pub(super) includes: Vec, + pub artifact: Option, // not actually optional + pub includes: Vec, - pub(super) pre_exec: Option, - pub(super) post_exec: Option, + pub pre_exec: Option, + pub post_exec: Option, - pub(super) depends: Vec, - pub(super) conflicts: Vec, + pub depends: Vec, + pub conflicts: Vec, } impl ManifestComponent for Mod {} @@ -407,16 +407,16 @@ mod data { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct IncludeData { - pub(super) dest: String, + pub dest: String, #[serde(with = "serde_bytes")] - pub(super) data: Vec, + pub data: Vec, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Mod { #[serde(with = "serde_bytes")] - pub(super) artifact_data: Vec, - pub(super) includes_data: Vec, + pub artifact_data: Vec, + pub includes_data: Vec, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] @@ -424,19 +424,19 @@ mod data { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Module { - pub(super) _id: String, - pub(super) required: bool, - pub(super) suggested: bool, + pub _id: String, + pub required: bool, + pub suggested: bool, #[serde(with = "serde_bytes")] - pub(super) artifact_data: Vec, - pub(super) includes_data: Vec, + pub artifact_data: Vec, + pub includes_data: Vec, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Lib { #[serde(with = "serde_bytes")] - pub(super) artifact_data: Vec, - pub(super) includes_data: Vec, + pub artifact_data: Vec, + pub includes_data: Vec, } impl ForgeModData for Mod {} @@ -488,22 +488,12 @@ impl ModBuilder { format_version: 1, kind: "mod".into(), manifest: self._manifest.into(), - _inner: self._inner, + data: self._inner, _marker: PhantomData, } } } -impl ForgeMod { - pub fn artifact_data(&self) -> &[u8] { - &self._inner.artifact_data - } - - pub fn includes_data(&self) -> &[data::IncludeData] { - &self._inner.includes_data - } -} - impl ModBuilder { pub fn new_module_parent(manifest: ForgeManifest) -> Self { Self { @@ -517,7 +507,7 @@ impl ModBuilder { format_version: 1, kind: "parent".into(), manifest: self._manifest.into(), - _inner: self._inner, + data: self._inner, _marker: PhantomData, } } @@ -566,22 +556,12 @@ impl ModBuilder { format_version: 1, kind: "module".into(), manifest: self._manifest.into(), - _inner: self._inner, + data: self._inner, _marker: PhantomData, } } } -impl ForgeMod { - pub fn artifact_data(&self) -> &[u8] { - &self._inner.artifact_data - } - - pub fn includes_data(&self) -> &[data::IncludeData] { - &self._inner.includes_data - } -} - impl ModBuilder { pub fn new_lib_raw(manifest: ForgeManifest, artifact_data: Vec) -> Self { Self { @@ -616,22 +596,12 @@ impl ModBuilder { format_version: 1, kind: "lib".into(), manifest: self._manifest.into(), - _inner: self._inner, + data: self._inner, _marker: PhantomData, } } } -impl ForgeMod { - pub fn artifact_data(&self) -> &[u8] { - &self._inner.artifact_data - } - - pub fn includes_data(&self) -> &[data::IncludeData] { - &self._inner.includes_data - } -} - #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct IncludeDataBuilder { pub(self) _inners: Vec,