#[non_exhaustive]pub struct BmsTableHeader {
pub name: String,
pub symbol: String,
pub data_url: String,
pub tag: Option<String>,
pub mode: Option<String>,
pub course: CourseGroup,
pub level_order: Vec<String>,
pub extra: BTreeMap<String, Value>,
}Expand description
BMS header information.
Strictly parses common fields and preserves unrecognized fields in extra for forward compatibility.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringTable name, e.g. “Satellite”
symbol: StringTable symbol, e.g. “sl”
data_url: StringURL of chart data file (preserves the original string from header JSON)
tag: Option<String>Tag label text; use effective_tag to
get the spec-mandated fallback to symbol when this is None.
mode: Option<String>Play mode hint; same semantics as bmson’s mode_hint
course: CourseGroupCourse information, preserving the original JSON nesting shape.
Supports flat arrays ("course": [{...}]) and arbitrarily nested arrays
("course": [[{...}]], "course": [[{...}], [{...}]], etc.).
Deserialized as a CourseGroup tree.
level_order: Vec<String>Difficulty level order containing numbers and strings
extra: BTreeMap<String, Value>Extra data (unrecognized fields from header JSON)
Implementations§
Source§impl BmsTableHeader
impl BmsTableHeader
Sourcepub const fn new(name: String, symbol: String, data_url: String) -> Self
pub const fn new(name: String, symbol: String, data_url: String) -> Self
Creates a new BmsTableHeader with the given required fields and defaults for everything else.
Sourcepub fn level_index(&self, level: &str) -> Option<usize>
pub fn level_index(&self, level: &str) -> Option<usize>
Returns the index of a level in level_order, or None if not found.
This is useful for comparing difficulty levels: a lower index means an easier level.
Note: This performs a linear scan (O(n)) on each call. For repeated
lookups across many chart items, consider building a
HashMap<&str, usize> from level_order once.
§Example
let mut header = BmsTableHeader::new(
"Test".into(),
"t".into(),
"d.json".into(),
);
header.level_order = vec!["1".into(), "2".into(), "3".into()];
assert_eq!(header.level_index("2"), Some(1));
assert_eq!(header.level_index("4"), None);Sourcepub fn effective_tag(&self) -> &str
pub fn effective_tag(&self) -> &str
Returns the effective tag, falling back to symbol when tag is None.
Per the BMS difficulty table spec, the tag field should fall back
to symbol when absent. This method implements that behavior.
§Example
let header = BmsTableHeader::new("Table".into(), "sl".into(), "d.json".into());
assert_eq!(header.effective_tag(), "sl");Trait Implementations§
Source§impl Clone for BmsTableHeader
impl Clone for BmsTableHeader
Source§fn clone(&self) -> BmsTableHeader
fn clone(&self) -> BmsTableHeader
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BmsTableHeader
impl Debug for BmsTableHeader
Source§impl<'de> Deserialize<'de> for BmsTableHeader
impl<'de> Deserialize<'de> for BmsTableHeader
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for BmsTableHeader
impl PartialEq for BmsTableHeader
Source§fn eq(&self, other: &BmsTableHeader) -> bool
fn eq(&self, other: &BmsTableHeader) -> bool
self and other values to be equal, and is used by ==.