Skip to main content

Crate bms_table

Crate bms_table 

Source
Expand description

BMS difficulty table parsing

Provides building a complete BMS difficulty table data structure from header JSON and chart data JSON, covering the header, courses, trophies, and chart items. Also includes HTML parsing for extracting the bmstable header URL from a page.

§Features

  • Parse header JSON into BmsTableHeader, preserving unrecognized fields in extra for forward compatibility;
  • Parse chart data into BmsTableData, supporting a plain array of ChartItem structure;
  • Courses automatically convert md5/sha256 lists into chart items, filling missing level with “0”;
  • Extract the header JSON URL from HTML <meta name="bmstable">.

§Usage

use bms_table::{BmsTable, BmsTableHeader, BmsTableData, CourseGroup};

let header_json = r#"{ "name": "Test", "symbol": "t", "data_url": "charts.json", "course": [], "level_order": [] }"#;
let data_json = r#"[]"#;
let header: BmsTableHeader = serde_json::from_str(header_json)?;
let data: BmsTableData = serde_json::from_str(data_json)?;
let table = BmsTable { header, data };
assert!(table.header.course.flatten().is_empty());

Structs§

BmsTable
Top-level BMS difficulty table data structure.
BmsTableData
BMS table data.
BmsTableHeader
BMS header information.
BmsTableHtml
HTML parsing for BMS difficulty tables.
BmsTableInfo
BMS difficulty table list item.
BmsTableList
Wrapper type for the list of BMS difficulty tables.
ChartItem
Chart data item.
CourseInfo
Course information.
Trophy
Trophy information.

Enums§

CourseGroup
Recursive course tree supporting arbitrary nesting depth.