You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code causes Rust Analyzer to "deduce" the type of *obj to be a form of Iterator instead of the Object type and shows the error Expected 1 argument, found 0 on line 35 by the .position() method call. Hovering over the error in the editor (VSCode) is pointing to core::iter::traits::iterator::Iterator.
The code compiles fine legion = "0.2.4" is required as a dependency.
use legion::prelude::*;#[derive(Clone,Default,Copy,Debug,PartialEq)]structPosition{x:f32,y:f32,}#[derive(Clone,Default,Copy,Debug,PartialEq)]structObject{pos:Position,}implObject{pubfnposition(&self) -> &Position{&self.pos}}fnmain(){// Create a world to store our entitieslet universe = Universe::new();letmut world = universe.create_world();// Create entities with `Position` and `Velocity` data
world.insert((), std::iter::once((Position::default(),Object::default(),)));// Create a query which finds all `Position` and `Velocity` componentslet query = <(Write<Position>,Read<Object>)>::query();// Iterate through all entities that match the query in the worldfor(mut pos, obj)in query.iter_mut(&mut world){*pos = *obj.position();println!("X: {:?}", pos);}}
The text was updated successfully, but these errors were encountered:
The following code causes Rust Analyzer to "deduce" the type of
*obj
to be a form ofIterator
instead of theObject
type and shows the errorExpected 1 argument, found 0
on line 35 by the.position()
method call. Hovering over the error in the editor (VSCode) is pointing tocore::iter::traits::iterator::Iterator
.The code compiles fine
legion = "0.2.4"
is required as a dependency.The text was updated successfully, but these errors were encountered: