#standard #codes #representing #iso #reporting #agency #agencies

codes-agency

This package provides a common code representing standards agencies

9 releases

0.1.9 Dec 25, 2022
0.1.8 Dec 22, 2022
0.1.2 Nov 30, 2022

#743 in Rust patterns

Download history 793/week @ 2024-01-05 811/week @ 2024-01-12 655/week @ 2024-01-19 1003/week @ 2024-01-26 709/week @ 2024-02-02 1236/week @ 2024-02-09 891/week @ 2024-02-16 2014/week @ 2024-02-23 2835/week @ 2024-03-01 1990/week @ 2024-03-08 1310/week @ 2024-03-15 1651/week @ 2024-03-22 1995/week @ 2024-03-29 1502/week @ 2024-04-05 2068/week @ 2024-04-12 915/week @ 2024-04-19

6,774 downloads per month
Used in 13 crates (10 directly)

MIT license

39KB
733 lines

Crate codes-agency

This package provides a common code representing standards agencies.

crates.io docs.rs

The two core types, [Agency] and [Standard] work together to provide reporting capabilities to other codes project packages. Specifically a package that provides types corresponding to a standard definition can have an instance of the [Standard] struct that describes the standard. This in turn references the [Agency] that controls the standard.

Consider the following example from the ISO 4217 package.

use codes_agency::{Agency, Standard};

// Taken from codes_iso_4217
pub const ISO_4217: Standard = Standard::new_with_long_ref(
    Agency::ISO,
    "4217",
    "ISO 4217:2015",
    "Currency codes",
    "https://www.iso.org/iso-4217-currency-codes.html",
);

assert_eq!(ISO_4217.agency().to_string(), String::from("ISO"));
assert_eq!(ISO_4217.short_ref(), "4217");
assert_eq!(ISO_4217.long_ref(), Some(&"ISO 4217:2015"));
assert_eq!(ISO_4217.title(), "Currency codes");
assert_eq!(ISO_4217.url(), "https://www.iso.org/iso-4217-currency-codes.html");

For notes on the design of the API, see the repository README.

Features

By default only the serde feature is enabled.

  • serde - Enables serialization of the Agency type.

Changes

Version 0.1.9

  • Added new standardized_type macro.

Version 0.1.8

  • Added new Standardized trait.

Version 0.1.7

  • Add the GS1 as a new Agency.

Version 0.1.6

  • Add the UN as a new Agency.

Version 0.1.5

  • Added ALL_CODES constant.

Version 0.1.4

  • Clean-up implementation based on newer codes-common
  • Using new Code trait and macro-created implementation.

Version 0.1.3

  • Added documentation to Agency variants.
  • Renamed Error to be inline with other package naming conventions.

Version 0.1.2

  • Remove the trait Code.
  • Remove some feature flags.
  • Added documentation.
  • Added IANA, IEEE, IETF as agencies.

Version 0.1.1

  • Initial documentation.

Version 0.1.0

  • Initial place-holder release.

TODO

  1. Create a build system from agencies.xml
  2. Add a parent_agency method (ITU is a part of UN)

Dependencies

~0.4–1MB
~24K SLoC