Skip to content

Commit

Permalink
Merge pull request #33 from Seldom-SE/pub_loaders
Browse files Browse the repository at this point in the history
Make loaders public
  • Loading branch information
NiklasEi authored Mar 31, 2024
2 parents 00e31aa + cf9fced commit 9bd9d16
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/csv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ where
}
}

struct CsvAssetLoader<A> {
/// Loads your asset type `A` from csv files
pub struct CsvAssetLoader<A> {
extensions: Vec<&'static str>,
_marker: PhantomData<A>,
delimiter: u8,
Expand Down
3 changes: 2 additions & 1 deletion src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ where
}
}

struct JsonAssetLoader<A> {
/// Loads your asset type `A` from json files
pub struct JsonAssetLoader<A> {
extensions: Vec<&'static str>,
_marker: PhantomData<A>,
}
Expand Down
3 changes: 2 additions & 1 deletion src/msgpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ where
}
}

struct MsgPackAssetLoader<A> {
/// Loads your asset type `A` from `MessagePack` files
pub struct MsgPackAssetLoader<A> {
extensions: Vec<&'static str>,
_marker: PhantomData<A>,
}
Expand Down
14 changes: 12 additions & 2 deletions src/postcard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ where
}
}

struct PostcardAssetLoader<A> {
/// Loads your asset type `A` from `Postcard` files
pub struct PostcardAssetLoader<A> {
extensions: Vec<&'static str>,
_marker: PhantomData<A>,
}
Expand Down Expand Up @@ -88,10 +89,19 @@ where
}
}

struct PostcardAssetSaver<A> {
/// Saves your asset type `A` to `Postcard` files
pub struct PostcardAssetSaver<A> {
_marker: PhantomData<A>,
}

impl<A> Default for PostcardAssetSaver<A> {
fn default() -> Self {
Self {
_marker: PhantomData,
}
}
}

impl<A: Asset + Serialize> AssetSaver for PostcardAssetSaver<A> {
type Asset = A;
type Settings = ();
Expand Down
3 changes: 2 additions & 1 deletion src/ron.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ where
}
}

struct RonAssetLoader<A> {
/// Loads your asset type `A` from ron files
pub struct RonAssetLoader<A> {
extensions: Vec<&'static str>,
_marker: PhantomData<A>,
}
Expand Down
3 changes: 2 additions & 1 deletion src/toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ where
}
}

struct TomlAssetLoader<A> {
/// Loads your asset type `A` from toml files
pub struct TomlAssetLoader<A> {
extensions: Vec<&'static str>,
_marker: PhantomData<A>,
}
Expand Down
3 changes: 2 additions & 1 deletion src/xml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ where
}
}

struct XmlAssetLoader<A> {
/// Loads your asset type `A` from xml files
pub struct XmlAssetLoader<A> {
extensions: Vec<&'static str>,
_marker: PhantomData<A>,
}
Expand Down
3 changes: 2 additions & 1 deletion src/yaml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ where
}
}

struct YamlAssetLoader<A> {
/// Loads your asset type `A` from yaml files
pub struct YamlAssetLoader<A> {
extensions: Vec<&'static str>,
_marker: PhantomData<A>,
}
Expand Down

0 comments on commit 9bd9d16

Please sign in to comment.