1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
//! FinTS codec: wire syntax, data element types and declarative segments.
//!
//! - [`wire`]: tokenizer and serializer for the FinTS syntax (Formals H.1),
//! ISO 8859-1, panic-free.
//! - [`types`]: the data element formats (Formals B.4): [`An`], [`Num`],
//! [`Dig`], [`Jn`], [`Dat`], [`Tim`], [`Cur`], [`Wrt`], [`Btg`], [`Bin`],
//! [`Id`], [`Code`].
//! - [`Segment`] / [`DataElementGroup`] derives: one struct per segment
//! version or group, generating parse and serialise. Definitions live in
//! [`defs`]; [`registry`] lists them for lookup by (code, version).
//! - [`schema`]: a static description of every definition
//! ([`SegmentDef::schema`]), generated by the derives.
//! - Raw fallback: [`parse_message`] / [`parse_segment`] give
//! [`ParsedSegment::Typed`], or [`ParsedSegment::Raw`] with the
//! tokenized segment and the [`CodecError`] that kept it from being typed.
//!
//! How to add a segment: `docs/codec.md`.
// The crate-level `#![allow]` in lib.rs is for imported code; new code here
// is held to the full lint set.
// Without the `tooling` feature the module is crate-internal and its public
// API goes unused.
pub use crate;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
/// Paths used by code that `fints-client-derive` generates. Not a stable API.
/// Attribute misuse that must not compile.
///
/// An open repetition that is not the last element of its group:
///
/// ```compile_fail
/// use fints_client::codec::{An, DataElementGroup};
/// #[derive(DataElementGroup)]
/// struct Bad { list: Vec<An>, after: An }
/// ```
///
/// A group that ends in an open repetition, nested before another element:
///
/// ```compile_fail
/// use fints_client::codec::{An, DataElementGroup};
/// #[derive(DataElementGroup)]
/// struct Open { #[de(min_count = 1)] list: Vec<An> }
/// #[derive(DataElementGroup)]
/// struct Bad { open: Open, after: An }
/// ```
///
/// A repeated segment element without `max_count` that is not the last:
///
/// ```compile_fail
/// use fints_client::codec::{An, Segment};
/// #[derive(Segment)]
/// #[segment(code = "XBAD", version = 1)]
/// struct Bad { list: Vec<An>, after: An }
/// ```
///
/// A length rule on a group:
///
/// ```compile_fail
/// use fints_client::codec::{Btg, Segment};
/// #[derive(Segment)]
/// #[segment(code = "XBAD", version = 1)]
/// struct Bad { #[de(max = 3)] amount: Btg }
/// ```
///
/// Repetition counts on a field that is not a `Vec`, an unknown attribute,
/// both `max` and `len`, and a missing `#[segment]`:
///
/// ```compile_fail
/// use fints_client::codec::{An, Segment};
/// #[derive(Segment)]
/// #[segment(code = "XBAD", version = 1)]
/// struct Bad { #[de(max_count = 2)] one: An }
/// ```
///
/// ```compile_fail
/// use fints_client::codec::{An, Segment};
/// #[derive(Segment)]
/// #[segment(code = "XBAD", version = 1)]
/// struct Bad { #[de(maximum = 2)] one: An }
/// ```
///
/// ```compile_fail
/// use fints_client::codec::{An, Segment};
/// #[derive(Segment)]
/// #[segment(code = "XBAD", version = 1)]
/// struct Bad { #[de(max = 2, len = 2)] one: An }
/// ```
///
/// ```compile_fail
/// use fints_client::codec::{An, Segment};
/// #[derive(Segment)]
/// struct Bad { one: An }
/// ```
///
/// The same definitions written correctly compile:
///
/// ```
/// use fints_client::codec::{An, Btg, DataElementGroup, Segment};
/// #[derive(DataElementGroup)]
/// struct Good { after: An, list: Vec<An> }
/// #[derive(Segment)]
/// #[segment(code = "XGOOD", version = 1)]
/// struct GoodSeg { #[de(max_count = 3)] list: Vec<An>, amount: Btg, #[de(max = 2)] one: An }
/// ```
;