Function std::intrinsics::needs_drop[][src]

pub const extern "rust-intrinsic" fn needs_drop<T>() -> bool
🔬 This is a nightly-only experimental API. (core_intrinsics)

intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library

Expand description

如果 T 给出的实际类型需要丢弃 glue,则返回 true。如果为 T 提供的实际类型实现 Copy,则返回 false

如果实际类型既不需要丢弃 glue 也不需要实现 Copy,则该函数的返回值不确定。

请注意,与大多数内联函数不同,这对调用是安全的; 它不需要 unsafe 块。 因此,实现不得要求用户维护任何安全不可变变量。

此内联函数的稳定版本为 mem::needs_drop