Separate from the macro_tests module because it doesn't actually test
macros, it uses it as a convenience.
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
The idna crate validates against UTS 46, which supports domains using
either IDNA2003 or IDNA2008. This allows us to support both old and
new internationalized domain names.
This dependency isn’t a new one in the tree, as hickory-proto, url and
tokio-xmpp all were already depending on it.
There are a bunch of other checks that have to be performed, this is
inspired by slixmpp’s JID implementation.
This additionally should optimize the parsing a tiny bit by looking for
both @ and / at the same time and iterating on them, instead of one by
one.
Thanks nicoco for the report!
This function always appends to an existing string, so by passing it a
String directly we can avoid superfluous allocations.
Also tokio-xmpp was doing a bunch of &str to String for no reason around
there, let’s remove that too.
insecure-tcp requires the io-util feature of tokio, so let’s enable it
there.
Fixes this error:
5 | use tokio::{io::BufStream, net::TcpStream};
| ^^^^^^^^^^^^^ no `BufStream` in `io`
They really clutter the documentation, because they show up in the
module's index. Downside is that users can't inspect the documentation
of those types anymore, but it's not useful anyway: the parts are
private and they just impl some traits.
This allows exactly one arbitrary payload in any element, and is handled
after every other element with a more specific matcher has been parsed.
Both the #[xml(element(n = 1))] meta and its shortcut #[xml(element)]
are allowed and treated the exact same way.
No need to fetch the entire history. The merge base is likely within the
last couple commits because we require it to be so anyway, because the
repo requires fast-forward merges currently.
skip-changelog, because this doesn't touch library code.
It is broken because of an expired token and the fix doesn't seem to be
trivial, so we disable it for now so that the pipelines become green
again.
skip-changelog, this is not a code change.
The remaining two were core::str::FromStr and
alloc::collections::BTreeMap.
Note that this doesn’t allow us to be no_std yet.
skip-changelog: This isn’t in any way user-visible, except that some
structs are now slightly smaller.
The Client::send_stanza method blocks on the stanza actually being sent
over the stream. Without this change, the method will never return
on streams without XEP-0198 Stream Management because `sm_state` is
then None and thus the StanzaToken's state is never advanced: it would
be stuck in Queued state.
In addition, a lack of advancement to Sent state may cause a deadlock on
XEP-0198-enabled streams if data is received so fast that the
frontend_tx mpsc::Sender in the stanzastream::Worker is filled up. In
such a case, the Worker cannot obtain a permit and will only service
writes. However, that will mean that no StanzaTokens can be advanced
beyond Queued state, because for that, reads need to be serviced (to
receive the SM acks).
If a burst of stanzas is then received while Client::send_stanza is
being awaited, send_stanza can only return if something reads from the
frontend mpsc in the meantime. We do not want to require user code to
drive the Client in full-duplex mode, hence this is a bug.
skip-changelog, because this fixes an unreleased feature.
The `xso::text::Base64` struct remains as a shorthand (because frankly,
I find the const names in the base64 crate very unwieldly), but you can
now use any of the base64 engines as codec.
The case this affects is a field like:
```
struct Foo {
#[xml(extract(fields(text(type_ = String)), namespace = .., name = ..))]
foo: ServiceType,
}
```
Before, we get this:
```
error[E0631]: type mismatch in closure arguments
--> muchopper/libmuchopper/src/xmpp/sjn_api.rs:188:10
|
188 | #[derive(AsXml)]
| ^^^^^
| |
| expected due to this
| found signature defined here
|
= note: expected closure signature `fn(&ServiceType) -> _`
found closure signature `fn(&'xso_proc_as_xml_iter_lifetime std::string::String) -> _`
note: required by a bound in `std::option::Option::<T>::map`
--> /home/jssfr/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:1102:12
|
1100 | pub fn map<U, F>(self, f: F) -> Option<U>
| --- required by a bound in this associated function
1101 | where
1102 | F: FnOnce(T) -> U,
| ^^^^^^^^^^^^^^ required by this bound in `Option::<T>::map`
= note: this error originates in the derive macro `AsXml` (in Nightly builds, run with -Z macro-backtrace for more info)
```
Afterwards, this:
```
error[E0308]: mismatched types
--> muchopper/libmuchopper/src/xmpp/sjn_api.rs:207:20
|
206 | #[xml(extract(namespace = ECS, name = "service-type", fields(text(type_ = String))))]
| ------ expected due to this
207 | pub service_type: ServiceType,
| ^^^^^^^^^^^ expected `Option<&String>`, found `Option<&ServiceType>`
|
= note: expected enum `std::option::Option<&'xso_proc_as_xml_iter_lifetime std::string::String>`
found enum `std::option::Option<&ServiceType>`
```
skip-changelog, because this affects a feature which already has an
"Added" line in the changelog.
uuid 1.12 introduced the NonNilUuid type, which can, like the Uuid
type, be parsed from a string. The Uuid type now implements
PartialEq<Self> and PartialEq<NonNilUuid>. That breaks type inferrence,
because the compiler now cannot know whether we want to parse a Uuid or
a NonNilUuid.
We thus have to be explicit.