Crates.io | tf2-sku |
lib.rs | tf2-sku |
version | 0.5.0 |
source | src |
created_at | 2022-07-10 06:19:39.80156 |
updated_at | 2024-08-03 07:48:08.295666 |
description | SKU parser for Team Fortress 2 items. |
homepage | https://github.com/juliarose/tf2-sku |
repository | https://github.com/juliarose/tf2-sku |
max_upload_size | |
id | 622971 |
size | 59,953 |
For parsing attributes from SKU strings.
use tf2_sku::SKU;
use tf2_enum::{Quality, KillstreakTier, Spell, StrangePart};
let sku = "264;11;kt-1".parse::<SKU>().unwrap();
assert_eq!(sku.defindex, 264);
assert_eq!(sku.quality, Quality::Strange);
assert_eq!(sku.killstreak_tier, Some(KillstreakTier::Killstreak));
assert_eq!(sku.to_string(), "264;11;kt-1");
// Also supports spells and strange parts
let sku = "627;11;footprints-2;sp-28".parse::<SKU>().unwrap();
assert!(sku.spells.contains(&Spell::HeadlessHorseshoes));
assert!(sku.strange_parts.contains(&StrangePart::Dominations));