Function std::intrinsics::variant_count[][src]

pub const extern "rust-intrinsic" fn variant_count<T>() -> usize
🔬 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

返回强制转换为 usizeT 类型的成员的数量; 如果 T 没有成员,则返回 0。无人居住的成员将被计算在内。

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

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