First switch to LazyLock from OnceLock, to simplify the code.
Then concatenate the colour reset escape code instead of using
format!(), since the vast majority of those strings have more capacity
than their length it will avoid a reallocation in most cases.
This allows to detect and handle dying streams without getting stuck
forever.
Timeouts are always wrong, though, so we put the burden of choosing the
right values (mostly) on the creator of a stream.
Without the early return in XmlStream::poll_next in case of the stream
footer, the read state gets recreated and the logic at the top of that
function to actually handle stream shutdown gracefully is never
triggered.
Also that logic was incorrect; the correct behaviour is to wait for the
true EOF.
Jonas Schäfer
created
efc859a
xmlstream: re-introduce syntax-highlit logging of XML stream I/O
Jonas Schäfer
created
c01eb09
xso-proc: improve error messages on cast mismatch for extracts
Click to expand commit body
The old error message was pointing at the `FromXml` / `AsXml` invocation
and not on the field which actually caused the problem. The new error
message points exactly at the type of the affected field.
c85c98b
xmlstream: improve responder-side of stream resets
Click to expand commit body
This makes the stream resets a lot safer, by preventing the forbidden
send-read-reset combination of events: the reset function on the
responder side now takes the element to send right before the reset,
enforcing a send-reset pattern.
Jonas Schäfer
created
ab10e30
Port crates to use new XSO-based xmlstream
3c78310
parsers: add umbrella enum for SASL elements
Click to expand commit body
This is useful if, for example during stream negotiation, you want to
parse SASL elements and nothing else. It is also useful if you want to
write down an enum of all XMPP-related stream-level elements you accept
and don't want to loose your fingers typing all the SASL options.
Jonas Schäfer
created
fc68a57
parsers: provide stub FromXml/AsXml implementations on Presence
Jonas Schäfer
created
b931af3
parsers: provide stub FromXml/AsXml implementations on Iq
Jonas Schäfer
created
5c990a5
xso: enable rxml macros when enabling xso_proc
Click to expand commit body
We build syn then anyway, so we can build rxml macros, too.
You may note that I removed the `exhaustive` flag on the
DefinedCondition enum. This is because other elements in the same
namespace may occur as siblings of that enum, hence using `exhaustive`
may cause incorrect parse errors.
(If parsing attempts to process the `<text/>` child as DefinedCondition
first, DefinedCondition will return a fatal parser error if it is set as
exhaustive because no condition matches `text`.)
f1ab857
xso: move helper iterators and builders into separate module
Click to expand commit body
This declutters the main `xso` namespace. In addition, if (when) we
introduce more complex generic implementations, we might want to have
tests for these, and those can then live there, too, without making the
main `lib.rs` file gigantic (or moving the tests too far away from the
tested code).
Jonas Schäfer
created
9f4af16
Component is now behind insecure-tcp feature flag