From 21b5ad3b76b509af916f5b22ba1435e407f0693f Mon Sep 17 00:00:00 2001 From: Seldom <38388947+Seldom-SE@users.noreply.github.com> Date: Sun, 31 Mar 2024 00:22:44 -0700 Subject: [PATCH 1/4] Made loaders public --- src/csv.rs | 2 +- src/json.rs | 2 +- src/msgpack.rs | 2 +- src/postcard.rs | 2 +- src/ron.rs | 2 +- src/toml.rs | 2 +- src/xml.rs | 2 +- src/yaml.rs | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/csv.rs b/src/csv.rs index c7eaa3b..8fa9afd 100644 --- a/src/csv.rs +++ b/src/csv.rs @@ -62,7 +62,7 @@ where } } -struct CsvAssetLoader { +pub struct CsvAssetLoader { extensions: Vec<&'static str>, _marker: PhantomData, delimiter: u8, diff --git a/src/json.rs b/src/json.rs index 27fc450..9c2dca4 100644 --- a/src/json.rs +++ b/src/json.rs @@ -37,7 +37,7 @@ where } } -struct JsonAssetLoader { +pub struct JsonAssetLoader { extensions: Vec<&'static str>, _marker: PhantomData, } diff --git a/src/msgpack.rs b/src/msgpack.rs index ac0a343..e3ee0b0 100644 --- a/src/msgpack.rs +++ b/src/msgpack.rs @@ -37,7 +37,7 @@ where } } -struct MsgPackAssetLoader { +pub struct MsgPackAssetLoader { extensions: Vec<&'static str>, _marker: PhantomData, } diff --git a/src/postcard.rs b/src/postcard.rs index 3f41562..d990c92 100644 --- a/src/postcard.rs +++ b/src/postcard.rs @@ -44,7 +44,7 @@ where } } -struct PostcardAssetLoader { +pub struct PostcardAssetLoader { extensions: Vec<&'static str>, _marker: PhantomData, } diff --git a/src/ron.rs b/src/ron.rs index 60c602e..033f968 100644 --- a/src/ron.rs +++ b/src/ron.rs @@ -37,7 +37,7 @@ where } } -struct RonAssetLoader { +pub struct RonAssetLoader { extensions: Vec<&'static str>, _marker: PhantomData, } diff --git a/src/toml.rs b/src/toml.rs index a491b27..6146910 100644 --- a/src/toml.rs +++ b/src/toml.rs @@ -37,7 +37,7 @@ where } } -struct TomlAssetLoader { +pub struct TomlAssetLoader { extensions: Vec<&'static str>, _marker: PhantomData, } diff --git a/src/xml.rs b/src/xml.rs index 15312c9..40d4ff4 100644 --- a/src/xml.rs +++ b/src/xml.rs @@ -39,7 +39,7 @@ where } } -struct XmlAssetLoader { +pub struct XmlAssetLoader { extensions: Vec<&'static str>, _marker: PhantomData, } diff --git a/src/yaml.rs b/src/yaml.rs index b855c55..e7a1434 100644 --- a/src/yaml.rs +++ b/src/yaml.rs @@ -37,7 +37,7 @@ where } } -struct YamlAssetLoader { +pub struct YamlAssetLoader { extensions: Vec<&'static str>, _marker: PhantomData, } From 636ede3af88243ad304faa32608f1d00bd769ace Mon Sep 17 00:00:00 2001 From: Seldom <38388947+Seldom-SE@users.noreply.github.com> Date: Sun, 31 Mar 2024 00:57:05 -0700 Subject: [PATCH 2/4] Also made `PostcardAssetSaver` public --- src/postcard.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/postcard.rs b/src/postcard.rs index d990c92..24ea086 100644 --- a/src/postcard.rs +++ b/src/postcard.rs @@ -88,7 +88,7 @@ where } } -struct PostcardAssetSaver { +pub struct PostcardAssetSaver { _marker: PhantomData, } From 5ffe5995f925fca751c551cc8dd4a97985469ecc Mon Sep 17 00:00:00 2001 From: Seldom <38388947+Seldom-SE@users.noreply.github.com> Date: Sun, 31 Mar 2024 01:02:42 -0700 Subject: [PATCH 3/4] Loader and saver docs --- src/csv.rs | 1 + src/json.rs | 1 + src/msgpack.rs | 1 + src/postcard.rs | 2 ++ src/ron.rs | 1 + src/toml.rs | 1 + src/xml.rs | 1 + src/yaml.rs | 1 + 8 files changed, 9 insertions(+) diff --git a/src/csv.rs b/src/csv.rs index 8fa9afd..91e04b4 100644 --- a/src/csv.rs +++ b/src/csv.rs @@ -62,6 +62,7 @@ where } } +/// Loads your asset type `A` from csv files pub struct CsvAssetLoader { extensions: Vec<&'static str>, _marker: PhantomData, diff --git a/src/json.rs b/src/json.rs index 9c2dca4..34b123f 100644 --- a/src/json.rs +++ b/src/json.rs @@ -37,6 +37,7 @@ where } } +/// Loads your asset type `A` from json files pub struct JsonAssetLoader { extensions: Vec<&'static str>, _marker: PhantomData, diff --git a/src/msgpack.rs b/src/msgpack.rs index e3ee0b0..de58697 100644 --- a/src/msgpack.rs +++ b/src/msgpack.rs @@ -37,6 +37,7 @@ where } } +/// Loads your asset type `A` from `MessagePack` files pub struct MsgPackAssetLoader { extensions: Vec<&'static str>, _marker: PhantomData, diff --git a/src/postcard.rs b/src/postcard.rs index 24ea086..94ed7eb 100644 --- a/src/postcard.rs +++ b/src/postcard.rs @@ -44,6 +44,7 @@ where } } +/// Loads your asset type `A` from `Postcard` files pub struct PostcardAssetLoader { extensions: Vec<&'static str>, _marker: PhantomData, @@ -88,6 +89,7 @@ where } } +/// Saves your asset type `A` to `Postcard` files pub struct PostcardAssetSaver { _marker: PhantomData, } diff --git a/src/ron.rs b/src/ron.rs index 033f968..3d9745b 100644 --- a/src/ron.rs +++ b/src/ron.rs @@ -37,6 +37,7 @@ where } } +/// Loads your asset type `A` from ron files pub struct RonAssetLoader { extensions: Vec<&'static str>, _marker: PhantomData, diff --git a/src/toml.rs b/src/toml.rs index 6146910..7f37bcb 100644 --- a/src/toml.rs +++ b/src/toml.rs @@ -37,6 +37,7 @@ where } } +/// Loads your asset type `A` from toml files pub struct TomlAssetLoader { extensions: Vec<&'static str>, _marker: PhantomData, diff --git a/src/xml.rs b/src/xml.rs index 40d4ff4..ab0fb6f 100644 --- a/src/xml.rs +++ b/src/xml.rs @@ -39,6 +39,7 @@ where } } +/// Loads your asset type `A` from xml files pub struct XmlAssetLoader { extensions: Vec<&'static str>, _marker: PhantomData, diff --git a/src/yaml.rs b/src/yaml.rs index e7a1434..d034d05 100644 --- a/src/yaml.rs +++ b/src/yaml.rs @@ -37,6 +37,7 @@ where } } +/// Loads your asset type `A` from yaml files pub struct YamlAssetLoader { extensions: Vec<&'static str>, _marker: PhantomData, From cf9fcedf4a1dfc75be9f97ecf6a84347e9dc795e Mon Sep 17 00:00:00 2001 From: Seldom <38388947+Seldom-SE@users.noreply.github.com> Date: Sun, 31 Mar 2024 01:27:57 -0700 Subject: [PATCH 4/4] impl `Default` for `PostcardAssetSaver` --- src/postcard.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/postcard.rs b/src/postcard.rs index 94ed7eb..f21efb0 100644 --- a/src/postcard.rs +++ b/src/postcard.rs @@ -94,6 +94,14 @@ pub struct PostcardAssetSaver { _marker: PhantomData, } +impl Default for PostcardAssetSaver { + fn default() -> Self { + Self { + _marker: PhantomData, + } + } +} + impl AssetSaver for PostcardAssetSaver { type Asset = A; type Settings = ();