pub struct TrId(/* private fields */);Expand description
Technische-Ressource-ID — 11 characters, ASCII-Verfahren check digit. Technische-Ressource-ID (TR-ID): 11-character identifier for a technical resource.
Defined by BDEW “Identifikatoren in der Marktkommunikation” v1.2 (February 2025), §6.2 and §6.6. Used in Redispatch 2.0 to identify technische Ressourcen (physical generation/consumption units).
§Format (§6.6)
| Position | Content | Character set |
|---|---|---|
| 1 | Codetyp — always 'D' (Technische Ressource) | {D} |
| 2–10 | Alphanumeric body | [A-Z0-9] |
| 11 | Check digit (ASCII-Verfahren, §8.2) | [0-9] |
Uses the same ASCII-Verfahren check digit algorithm as NeloId
and SrId.
§Examples
use rubo4e::identifiers::TrId;
let id = TrId::new("D0000000002").unwrap();
assert_eq!(id.to_string(), "D0000000002");
let id = TrId::from_base("D000000000").unwrap();
assert_eq!(id.as_ref(), "D0000000002");Implementations§
Source§impl TrId
impl TrId
Sourcepub fn new(s: &str) -> Result<TrId, IdentifierError>
pub fn new(s: &str) -> Result<TrId, IdentifierError>
Creates a new TrId after full validation.
§Errors
IdentifierError::InvalidLengthifsis not exactly 11 characters.IdentifierError::InvalidFormatif the first character is not'D'.IdentifierError::InvalidCharacterif positions 2–10 contain characters outside[A-Z0-9], or position 11 is not a decimal digit.IdentifierError::InvalidChecksumif the 11th digit does not match the ASCII-Verfahren check digit.
Sourcepub fn from_base(base: &str) -> Result<TrId, IdentifierError>
pub fn from_base(base: &str) -> Result<TrId, IdentifierError>
Constructs a valid TrId from a 10-character base string by computing
and appending the ASCII-Verfahren check digit.
base[0] must be 'D'; base[1..=9] must be [A-Z0-9].
§Errors
IdentifierError::InvalidLengthifbaseis not exactly 10 characters.IdentifierError::InvalidFormatifbase[0]is not'D'.IdentifierError::InvalidCharacterif positions 2–10 are not[A-Z0-9].
§Examples
use rubo4e::identifiers::TrId;
let id = TrId::from_base("D000000000").unwrap();
assert_eq!(id.as_ref(), "D0000000002");Sourcepub fn check_digit(base: &str) -> Result<u8, IdentifierError>
pub fn check_digit(base: &str) -> Result<u8, IdentifierError>
Computes the ASCII-Verfahren check digit for a 10-character TR-ID base.
Returns the check digit value (0–9) without constructing a TrId.
§Errors
IdentifierError::InvalidLengthifbaseis not exactly 10 characters.IdentifierError::InvalidFormatifbase[0]is not'D'.IdentifierError::InvalidCharacterif positions 2–10 are not[A-Z0-9].
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TrId
Available on crate feature serde only.
impl<'de> Deserialize<'de> for TrId
serde only.Source§fn deserialize<D>(d: D) -> Result<TrId, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(d: D) -> Result<TrId, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl Eq for TrId
Source§impl JsonSchema for TrId
impl JsonSchema for TrId
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Ord for TrId
impl Ord for TrId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for TrId
impl PartialOrd for TrId
Source§impl Serialize for TrId
Available on crate feature serde only.
impl Serialize for TrId
serde only.Source§fn serialize<S>(
&self,
s: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
s: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl StructuralPartialEq for TrId
Source§impl Validate for TrId
impl Validate for TrId
Source§fn validate_into(
&self,
__garde_user_ctx: &<TrId as Validate>::Context,
__garde_path: &mut dyn FnMut() -> Path,
__garde_report: &mut Report,
)
fn validate_into( &self, __garde_user_ctx: &<TrId as Validate>::Context, __garde_path: &mut dyn FnMut() -> Path, __garde_report: &mut Report, )
Self, aggregating all validation errors into Report.Auto Trait Implementations§
impl Freeze for TrId
impl RefUnwindSafe for TrId
impl Send for TrId
impl Sync for TrId
impl Unpin for TrId
impl UnsafeUnpin for TrId
impl UnwindSafe for TrId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T, O> Matches<O> for Twhere
T: PartialEq<O>,
impl<T, O> Matches<O> for Twhere
T: PartialEq<O>,
fn validate_matches(&self, other: &O) -> bool
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more