Closed wtdcode closed 1 month ago
@DaniPopes @mattsse Hey guys, any advice on this? I can also draft a PR but I need to know the intended way to handle this:
Deref
for LogData
or,&mut self
?Or do I miss something?
let mut log = alloy_primitives::Log::empty();
let topics = log.data.topics_mut();
Log
only has Deref for the wrapped data, but since data is pub anyway, we could also just impl derefmut as well imo
let mut log = alloy_primitives::Log::empty(); let topics = log.data.topics_mut();
Ohhhhh, you are correct! I didn't notice data
is public XD. I will draft a PR for DerefMut
.
Closed by #786
Component
primitives
What version of Alloy are you on?
alloy-primitives v0.8.8
Operating System
Linux
Describe the bug
main.rs
cargo.toml
This gives error:
I have no idea when
LogData::topics_mut_unchecked
andLogData::topics_mut
should be used withoutDerefMut
implemented. It looks like it is by design not to implementDerefMut
but it makes it impossible to call these two functions (and other functions taking&mut self
).