xso-proc: add fancy hack to allow codec = Foo<Bar>

We can do this because we know that `x < y` cannot create a
`TextCodec<T>` for any `T`. This is because `<` is guaranteed to return
a boolean value, and we simply don't implement `TextCodec<T>` on bool.
This commit is contained in:
Jonas Schäfer 2024-08-03 11:19:09 +02:00
commit 2fe3c0cef2
4 changed files with 120 additions and 12 deletions

View file

@ -20,7 +20,7 @@ pub struct Handshake {
///
/// If None, it is the successful reply from the server, the stream is now
/// fully established and both sides can now exchange stanzas.
#[xml(text(codec = FixedHex::<20>))]
#[xml(text(codec = FixedHex<20>))]
pub data: Option<[u8; 20]>,
}

View file

@ -30,7 +30,7 @@ pub struct VCardUpdate {
#[xml(namespace = ns::VCARD_UPDATE, name = "photo")]
pub struct Photo {
/// The SHA1 hash of the avatar. Empty when there is no photo.
#[xml(text(codec = FixedHex::<20>))]
#[xml(text(codec = FixedHex<20>))]
pub data: Option<[u8; 20]>,
}