Skip to main content

Trace

Struct Trace 

Source
pub struct Trace {
    pub comment: String,
    pub client: Client,
    pub accounts: Vec<TraceAccount>,
    pub exchanges: Vec<Exchange>,
}
Available on crate feature trace only.
Expand description

A recorded dialog: the exchanges in order, and the accounts they name.

Fields§

§comment: String

Free text for readers (where and how the trace was recorded).

§client: Client

The client that recorded it, and how its run ended.

§accounts: Vec<TraceAccount>

Every account an exchange may name, listed once.

§exchanges: Vec<Exchange>

The exchanges, in the order they happened.

Implementations§

Source§

impl Trace

Source

pub fn from_exchanges(exchanges: Vec<Exchange>) -> Trace

A trace from redacted exchanges (as Recorder::exchanges returns them), anonymised further; no comment, no accounts:

  • dialog IDs (HNHBK) and order references (HITAN) become DIALOG0001, TASK0001, … everywhere they occur;
  • the product registration in HKVVB becomes stars.

Amounts, names and statements are shape-masked by the recorder already.

Source

pub fn remask(&mut self)

Masks the trace again, with the masking rules of this version of fints-client: for a trace recorded before the rules hid more. The stand-ins are made anew (aliases and pseudonyms of a fresh random salt, so they link to no other trace) and every date moves by a further 3 to 30 days. What the trace already hides stays hidden; unknown segments stay as they are, starred or kept. comment, client, accounts, and each exchange’s account, error and notes stay.

Source

pub fn set_outcome(&mut self, result: Result<(), &FinTSError>)

Records how the run ended: completed, or the kind of the error that stopped it (the variant, for a bank error its code), never its text.

Source

pub fn to_json(&self) -> String

The trace as one pretty-printed JSON document:

  • format (TRACE_FORMAT), comment (lines), bank (blz, bic: Trace::blz, Trace::bic), accounts (TraceAccounts);
  • exchanges, each with index, account (alias or null), retry_of, sent (jobs as CODE:version, tan as {process, for} or null), answer (message: HIRMG codes, segments: HIRMS codes with the job they refer to), failed, error, request and response.

request and response hold the message, one string per segment (the HNVSD header up to its @len@ and each segment inside HNVSD get their own; the closing ' of HNVSD is a string of its own), each byte as the ISO 8859-1 character of the same value: joined, they are the bytes again. They are the only source of truth; index, retry_of, sent, answer, failed and bank are derived from them for readers (see Trace::summary), and Trace::from_json rejects a file in which they differ.

Source

pub fn from_json(json: &str) -> Result<Trace, String>

Reads a trace written by Trace::to_json. Fails on another format, unknown fields, a character outside ISO 8859-1, an exchange naming an alias that accounts does not list, a failed exchange with a response, and any derived field that differs from what the raw request/response give (the error names the exchange and the field).

Source

pub fn blz(&self) -> Option<String>

The bank code the client logged in at (HKIDN of the first request that has one).

Source

pub fn bic(&self) -> Option<String>

The bank’s BIC: the BIC of the first account element (KTI, IBAN:BIC) a job of a request names.

Source

pub fn account(&self, alias: &str) -> Option<&TraceAccount>

The account with this alias.

Source

pub fn summary(&self) -> Vec<ExchangeSummary>

One ExchangeSummary per exchange. Never fails: a message that does not tokenize is reported as unreadable.

An exchange is a retry of the one before it (retry_of) when that one was answered with 9075 (strong customer authentication required) and it sends the same jobs again, now with HKTAN.

Source

pub fn summary_table(&self) -> String

The summary as a table for humans: SUMMARY_LEGEND, the accounts (one line each), then one line per exchange.

Trait Implementations§

Source§

impl Clone for Trace

Source§

fn clone(&self) -> Self

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 Debug for Trace

Source§

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

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

impl Default for Trace

Source§

fn default() -> Self

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

impl Eq for Trace

Source§

impl PartialEq for Trace

Source§

fn eq(&self, other: &Self) -> 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 Trace

Auto Trait Implementations§

§

impl Forget for Trace

§

impl Freeze for Trace

§

impl Move for Trace

§

impl RefUnwindSafe for Trace

§

impl Send for Trace

§

impl Sync for Trace

§

impl Unpin for Trace

§

impl UnsafeUnpin for Trace

§

impl UnwindSafe for Trace

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more