tf2-sku

Crates.iotf2-sku
lib.rstf2-sku
version0.5.0
sourcesrc
created_at2022-07-10 06:19:39.80156
updated_at2024-08-03 07:48:08.295666
descriptionSKU parser for Team Fortress 2 items.
homepagehttps://github.com/juliarose/tf2-sku
repositoryhttps://github.com/juliarose/tf2-sku
max_upload_size
id622971
size59,953
Julia (juliarose)

documentation

README

tf2-sku

For parsing attributes from SKU strings.

Usage

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));

License

MIT

Commit count: 47

cargo fmt