Skip to main content

AgencyCode

Enum AgencyCode 

Source
#[non_exhaustive]
pub enum AgencyCode { Bdew, Gs1, Entso, Dvgw, }
Expand description

EDIFACT DE 3055 — code list responsible agency for market participant identification.

Used in NAD segments (C082 component 2) and IDE segments to indicate which body issued the party identifier code. Choosing the wrong agency code produces non-conformant EDIFACT that receiving parties may reject.

In the German energy market (BDEW MaKo / EDI@Energy) the dominant code is AgencyCode::Bdew ("293"). Nearly all supplier, DSO, and MSB codes are issued and administered by BDEW and carry this agency qualifier — even when the 13-digit number is also a valid GS1 GLN (BDEW is a GS1 member prefix holder).

§Wire format

The agency code appears as the third component of the NAD C082 composite:

NAD+MS+{party_id}::{agency_code}'

The middle component (code list id, C082/1154) is always empty in EDI@Energy.

§Example

use edi_energy::AgencyCode;

assert_eq!(AgencyCode::Bdew.as_str(), "293");
assert_eq!(AgencyCode::Gs1.as_str(),  "9");
assert_eq!(AgencyCode::Entso.as_str(), "305");

// Parse from a raw NAD segment agency string.
assert_eq!(AgencyCode::parse("293"), Some(AgencyCode::Bdew));
assert_eq!(AgencyCode::parse("999"), None);

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Bdew

"293" — BDEW (Bundesverband der Energie- und Wasserwirtschaft).

Used for all BDEW-issued market participant codes in the German electricity and gas markets. This is the correct agency code for suppliers (LFN), distribution system operators (NB/VNB), metering point operators (MSB), and balance responsible parties (BKV/BRK) registered in the BDEW Marktteilnehmerverzeichnis.

§NAD wire form

NAD+MS+9900123456789::293'
§

Gs1

"9" — GS1 (formerly EAN International).

Used when a 13-digit GLN is issued directly under GS1’s global prefix scheme rather than through BDEW. Rare in German MaKo practice — most operators use AgencyCode::Bdew even for GS1-compatible numbers.

§

Entso

"305" — ECOD (ENTSO-E Coding Scheme / European network operator).

Used for 16-character EIC (Energy Identification Codes) issued by ENTSO-E. Required for transmission grid operators (ÜNB/TSO), balance zones (Regelzonen), and cross-border market participants.

§NAD wire form

NAD+MS+10XDE-EON-NETZ--I::305'
§

Dvgw

"332" — DVGW (Deutscher Verein des Gas- und Wasserfaches).

Occasionally used for gas-sector participants registered in the DVGW system before the BDEW merger. Modern gas market messages prefer AgencyCode::Bdew; this variant is kept for parsing legacy messages.

Implementations§

Source§

impl AgencyCode

Source

pub const DEFAULT: Self = Self::Bdew

Default agency code for new outbound EDI@Energy messages.

293 (BDEW) is the correct default for all standard German market participants. Change to AgencyCode::Entso only for TSO/ÜNB parties that carry an EIC code.

Source

pub fn as_str(self) -> &'static str

Return the wire-format string for the DE 3055 component.

Source

pub fn parse(s: &str) -> Option<Self>

Parse a DE 3055 agency code string.

Returns None for unrecognised codes; callers may fall back to treating the raw string as an opaque pass-through.

Trait Implementations§

Source§

impl Clone for AgencyCode

Source§

fn clone(&self) -> AgencyCode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for AgencyCode

Source§

impl Debug for AgencyCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AgencyCode

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for AgencyCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for AgencyCode

Source§

impl Hash for AgencyCode

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for AgencyCode

Source§

fn eq(&self, other: &AgencyCode) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AgencyCode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, O> Matches<O> for T
where T: PartialEq<O>,

Source§

fn validate_matches(&self, other: &O) -> bool

Source§

impl<T> ToCompactString for T
where T: Display,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.