doc.rust-lang.org
pub const unsafe fn transmute<Src, Dst>(src: Src) -> Dst
...For Vec, this means that both the size and alignment of the inner types have to match. Other containers might rely on the size of the type, alignment, or even the TypeId, in which case transmuting wouldn't be possible at all without violating the container invariants.
let store = [0...
function
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
primitive fn
...Note that FFI requires additional care to ensure that the ABI for both sides of the call match. The exact requirements are not currently documented.
Safety
Plain function pointers are obtained by casting either plain functions, or closures that don't capture an environment:
fn add_one(x: usize) -> usize...
primitive
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
primitive fn
...Note that FFI requires additional care to ensure that the ABI for both sides of the call match. The exact requirements are not currently documented.
Safety
Plain function pointers are obtained by casting either plain functions, or closures that don't capture an environment:
fn add_one(x: usize) -> usize...
primitive
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub mod pin
...fn check_for_move(&mut self) {
let current_addr = self as *mut Self as usize;
match self.0 {
None => self.0 = Some(current_addr),
Some(prev_addr) => assert_eq!(prev_addr, current_addr),
}
}
}
// Create a tracker and store the initial address
let mut tracker = AddrTracker::default();
tracker.check_for_move...
module
core
Stable since 1.33.0
Version 1.100.0-nightly