cost 196 ms
在 Rust nightly 中使用关联的常量和常量泛型时的类型不匹配 - Mismatched types when using associated consts and const generics in Rust nightly

因此,对于我正在编写的库,我想计算 N 维(2、3、4 等...)中两点之间的距离,并且我有一个 Point 特征,以便库的用户可以在他们的自己的类型,只要它们是“点像”。 我有一个特征“Point”,它的维度 (N) 和浮点类型 (T) 保持为关联类型和常量: pub trait Point: ...

为什么类型别名不能使用 Rust 中原始类型的关联常量? - Why can't a type alias use associated constants from the original type in Rust?

编者注:从 Rust 1.43 开始,这按预期工作。 我有一个类型别名type CardId = u64; 我想通过std::u64::MAX常量将它初始化为它可以拥有的最大数量。 并且惊讶地发现我不能从别名中做同样的事情。 use std::u64; type CardId = u64; ...

常量 ìf` 表达式条件下的关联常量 - Associated constants in condition of constant ìf`-expression

我正在尝试使用关联常量作为if表达式中的条件来初始化另一个常量。 我认为这应该可行,因为我可以直接使用关联的常量来初始化其他一些常量,因此它适用于 const 上下文,并且 if 表达式不依赖于任何其他值。 当我编译这个时,我收到一个错误: error[E0019]: constant cont ...


排序:
质量:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM