7 releases (4 breaking)

0.5.0 Aug 3, 2024
0.4.2 May 14, 2024
0.4.1 Feb 10, 2024
0.4.0 Oct 8, 2023
0.1.0 Jul 10, 2022

#2 in #fortress

Download history 119/week @ 2024-08-01 6/week @ 2024-08-08 6/week @ 2024-09-12 5/week @ 2024-09-19 10/week @ 2024-09-26 3/week @ 2024-10-03

370 downloads per month

MIT license

57KB
1K SLoC

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


lib.rs:

tf2-sku

SKU parser for Team Fortress 2 items.

Usage

use tf2_sku::SKU;
use tf2_sku::tf2_enum::{Quality, KillstreakTier, Spell};

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;6;footprints-2".parse::<SKU>().unwrap();

assert!(sku.spells.contains(&Spell::HeadlessHorseshoes));

Dependencies

~0.4–1MB
~23K SLoC