5 ms·
a::b::c::<T>()? // Rust try a.b.c(T) // Zig
by edflsafoiewq 8y ago
a::b::c::<T>()? // Rust
try a.b.c(T) // Zig
- steveklabnik 8y agoThat’s not what Rust looks like normally, though; usually you’d use “use” and the T is inferred. The :: and <> are also not particularly unusual syntax for their respective features either.
- edflsafoiewq 8y agoa::b::c is ugly compared to a.b.c whether you put it in an expression or in a use statement and ::<T>()? is not that rare (ex. rdr.read_u16::<BigEndian>()?). You asked what bothered us, not what was unusual :)
- steveklabnik 8y agoOh totally! I mean it as a way of sorting out why. Like, it would bother me more if I had to write it more, so maybe it’s that styles are different or some libraries require it more often? byteorder is one of those crates, it’s true, and I don’t use it super often. So this is helpful!