Skip to content

Commit

Permalink
Deserialize function
Browse files Browse the repository at this point in the history
  • Loading branch information
asny committed Dec 24, 2023
1 parent 52d9a06 commit 8c7097c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ mod vol;
#[cfg(feature = "pcd")]
mod pcd;

///
/// Deserialize a single file from raw bytes.
///
/// If the file depends on other files, use [RawAssets::insert] to insert the bytes for each of them in [RawAssets] before deserializing.
///
pub fn deserialize<T: Deserialize>(bytes: Vec<u8>) -> crate::Result<T> {
let mut assets = RawAssets::new();
assets.insert("", bytes);
assets.deserialize("")
}

///
/// Loads and deserialize a single file. If the file depends on other files, those files are also loaded.
///
Expand Down

0 comments on commit 8c7097c

Please sign in to comment.