Replies: 1 comment 1 reply
-
这句应该就是表达的 as 类型转换虽然可以进行级联的转换,但是不能认为实现了 e as U1 和 U1 as U2 就可以 e as U2 了。 enum MyEnum {
Zero,
}
fn main() {
let _raw_ptr1 = MyEnum::Zero as i32 as *const i32;
// let _raw_ptr2 = MyEnum::Zero as *const i32;
}
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
我注意到在Rust Course开源书中的类型转换一节有下面这样的一段话
这段话大家是否有什么好的例子来理解呢?我暂时没有想到如何构造这样的一个前面合理而后面不合理的情况,我只能暂时想到说
这两种转换方式最终损失的数据是不一样的,因此跑出来
b = 44
,c = 300
.Beta Was this translation helpful? Give feedback.
All reactions