Expand description
A library for parsing and manipulating Valve Map Format (VMF) files.
This library provides functionality to parse VMF files used in Source Engine games into Rust data structures, modify the data, and serialize it back into a VMF file.
§Example
use source_vmf::prelude::*;
use std::fs::File;
fn main() -> Result<(), VmfError> {
let vmf_file = VmfFile::open("vmf_examples/your_map.vmf")?;
println!("Map Version: {}", vmf_file.versioninfo.map_version);
Ok(())
}Re-exports§
pub use errors::VmfError;pub use errors::VmfResult;pub use parse_ctx::FromBlock;pub use parse_ctx::ParseCtx;pub use vmf::EntId;pub use vmf::EntityIndex;pub use vmf::VmfFile;
Modules§
- errors
- This module defines the error types used in the VMF parser using
thiserror. - parse_
ctx - Parser context for recording non-fatal syntax warnings and defaults during VMF parsing.
- parser
- This module provides the VMF parser implementation using the
source-kvlibrary. - prelude
- A prelude module that re-exports commonly used items from the
source_vmfcrate. - vmf
- This module contains the core data structures for representing VMF files,
including the
World,Entity,Solid, and other related types. It also re-exports the submodulescommon,entities,metadata,regions, andworld.
Structs§
- Extras
- Preserves unrecognized keys and nested blocks during parsing for lossless round-tripping.
- VmfBlock
- Represents a block in a VMF file, which can contain key-value pairs and other blocks.
Constants§
- REPEATED_
KEY_ SEP - Internal delimiter used to store multiple values of repeated keys in a single map entry.
Traits§
- VmfSerializable
- A trait for types that can be serialized into a VMF string representation.
Functions§
- join_
repeated_ key - Joins multiple values for a repeated key into a single string using
REPEATED_KEY_SEP. - write_
key_ value - Writes key-value pairs, expanding values joined by
REPEATED_KEY_SEPback into separate lines.