i’m staring at my dns name code and thinking that i have left case folding too late because it is making comparisons too complicated
2
1
i’m trying to make sure that my code doesn’t unnecessarily copy dns names e.g. let thing: BigStruct = fill_bigstruct_from(&data); i would like the filling to write directly to the caller’s stack frame and I’m looking at github.com/rust-lang/rust/is… so i need to do NRVO manually?
2
uh-oh, I made clippy ICE πŸ€“ paste.rs/Dy5
2
1
trying to choose a method name… reset? clear? I type β€œfn clear” then check what Vec calls it :- β€œclear”. Yay :-)
1
2
kind of disappointed that i need the impl here and now i’m not sure if the supertrait is doing anything useful trait HeapLen: DnsName { fn heap_len(&self) -> usize { 1 + self.labs() + self.nlen() } } impl<T: DnsName> HeapLen for T {}
1
the answer is that the supertrait is bringing the necessary methods into scope in the other case where i had a default function implementation, the methods it called were in the same trait
1
repeatedly trying to #[macro_use] a module and invoke one of its macros, and yet rustc insists the macro is not visible and have I forgotten to #[macro_use]?
2
macro_rules is annoyingly parse-order scoped rather than lexically scoped. make sure your macro is *before* its use in your codebase's parse order.
1
oh yeah now i remember took me an age to work it out last time :-/
1
maybe i should always declare all my submodules at the bottom :-)
1
Replying to @fanf
Or all your macros in a macros.rs and `#[macro_use] pub mod macros` at the top :D

May 22, 2021 Β· 8:38 PM UTC

1
Replying to @dsilverstone
heh, except this macro is an implementation detail to abbreviate some common trait impls
1