Skip to main content

read_tile_set

Function read_tile_set 

Source
pub fn read_tile_set(path: &Path) -> Result<Option<TileSet>, String>
Expand description

Read a prefab metadata file and say whether it describes a tile set.

Ok(None) means an ordinary single-template prefab — the caller carries on exactly as before. Ok(Some(_)) is a validated tile set. Err is a malformed file, never a shrug: every consumer that opens prefab metadata must be able to tell the two shapes apart, and the way a tool “handles” a tile set it has never heard of is by reading none of its blocks.

It reads the whole document through crate::prefab::PrefabMeta, not a private view of one key. A narrow reader here was a second reader: it accepted a document that declares no blocks at all as “not a tile set”, and it validated the manifest on a path the prefab registry never took. One reader means a manifest is refused the same way by the renderer, the admission tools and world assembly, or by none of them.