/artifact_serde

Primary LanguageRustMIT LicenseMIT

artifact_serde Build Status crates.io docs

A small Rust library for serializing/deserialzing Artifact Decks and Deck Codes. Created to support my other Rust Artifact library, but still provides its own use case for others.

Usage

To install, add to Cargo.toml

[dependencies]
artifact_serde = "0.3.0"

If you are still on rust version < 1.31.0 you will need to add this to your crate root

extern crate artifact_serde

Basic usage example

fn main() {
  let adc = "ADCJWkTZX05uwGDCRV4XQGy3QGLmqUBg4GQJgGLGgO7AaABR3JlZW4vQmxhY2sgRXhhbXBsZQ__";
  let mut my_deck = artifact_serde::decode(&adc).unwrap();
  
  // Should return a new String that is the same as the initial ADC
  let my_serialized_adc = artifact_serde::encode(&mut my_deck).unwrap();
}

my_deck will be an instance of DeserializedDeck, by itself it is not too useful, as you will still need to map the card ids to their respective cards. This is handled in my other library, but if you wish to use this on its own follow the instructions provided by Valve which is described in detail here