W3cubDocs

/Rust

Function std::ptr::replace

pub unsafe fn replace<T>(dest: *mut T, src: T) -> T

Moves src into the pointed dest, returning the previous dest value.

Neither value is dropped.

Safety

This is only unsafe because it accepts a raw pointer. Otherwise, this operation is identical to mem::replace.

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/ptr/fn.replace.html