gpt4 book ai didi

rust - 为什么 trait 没有实现?

转载 作者:行者123 更新时间:2023-12-03 11:34:56 25 4
gpt4 key购买 nike

我想试试 amethyst_physics库来制作游戏。 (废话)
我跟着示例,但我不工作:

use amethyst::GameDataBuilder;
use amethyst_physics::{PhysicsBundle};
use amethyst_nphysics::NPhysicsBackend;

fn main() -> amethyst::Result<()> {
amethyst::start_logger(Default::default());

let game_data = GameDataBuilder::default()
.with_bundle(
PhysicsBundle::<f32, NPhysicsBackend>::new()
)
;
Ok(())
}
错误:
the trait bound `amethyst_physics::PhysicsBundle<'_, '_, f32, amethyst_nphysics::NPhysicsBackend>: amethyst::amethyst_core::SystemBundle<'_, '_>` is not satisfied
the trait `amethyst::amethyst_core::SystemBundle<'_, '_>` is not implemented for `amethyst_physics::PhysicsBundle<'_, '_, f32, amethyst_nphysics::NPhysicsBackend>`
Here就是例子。
我究竟做错了什么?

最佳答案

这似乎是一个错误。它使用 amethyst 成功编译版本 0.15.1 但不是 0.15.3。在补丁更改期间不会出现这样的回归。amethyst用途 amethyst_core版本 0.15.3(其中定义了 SystemBundle)但是 amethyst_physics用途 amethyst_core版本 0.10.1。
我已经提交了 issue在紫 Crystal 仓库上。

将此用作解决方法:

amethyst = { version = ">=0.15.0, <0.15.3", features = ["empty"] } 

关于rust - 为什么 trait 没有实现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65145954/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com