Crate crustacean_states

Crate crustacean_states 

Source
Expand description

A NationStates API wrapper that takes full advantage of Rust’s type system.

Works with the current API (v12) as of 4 October 2023.

Using the library usually takes three steps:

  1. Creating a request (e.g. PublicNationRequest) with the relevant shards.
  2. Sending the request as a URL through a Client.
  3. Parsing the response using a parser in parsers.

Currently, the following requests can be formed and sent:

The following requests can be parsed:

  • Nation (some fields still being finalized)

The following functionality is planned, but is not implemented:

  • parsers for Region, World, and WA request responses
  • private shards
  • lighter-weight client using hyper
  • breaking crate into features

§Examples

For a list of examples, see the examples folder on GitHub.

Modules§

client
Additional tools for making requests.
models
Models that are useful for both sending and receiving information.
parsers
Contains the modules that parse responses from the NationStates API.
shards
A shard is a tiny request, composed of two parts: the query and the extra parameters. You add multiple shards together to get the most efficient response. Remember: 50 requests per 30 seconds is both a lot and very little at the same time!

Macros§

impl_display_as_debug
regex

Functions§

pretty_name
Takes a lowercase, web-safe name and replaces it with a name that should match the real name on NationStates.
safe_name
Takes a nation name with capital letters and spaces and turns it into a safe-to-send, lowercase name.