Crate tf2_sku

source ·
Expand description

§tf2-sku

SKU parser for Team Fortress 2 items.

§Usage

use tf2_sku::SKU;
use tf2_sku::tf2_enum::{Quality, KillstreakTier, Spell};
 
let sku = SKU::try_from("264;11;kt-1").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 = SKU::try_from("627;6;footprints-2").unwrap();
 
assert!(sku.spells.contains(&Spell::HeadlessHorseshoes));

Re-exports§

Modules§

Structs§

  • A SKU containing detailed fields to identify an item.
  • Contains up to 2 spells.
  • Contains up to 3 strange parts.

Traits§

  • Trait for converting to a SKU string.