Is there way to get raw pointer to field without dereferencing struct

⚓ rust    📅 2025-07-06    👤 surdeus    👁️ 1      

surdeus

I am specifically ask about new &raw const/&raw mut syntax.

I know that I can just use addr_of in std::ptr - Rust macro.

E.g. if I have struct

struct S {
  a: u32,
  b: u32,
}

how I express core::ptr::addr_of!((*s).a) using new syntax?

3 posts - 2 participants

Read full topic

🏷️ rust_feed