naia-lib / naia

a cross-platform (including Wasm!) networking library built in Rust. Intended to make multiplayer game development dead-simple & lightning-fast
Apache License 2.0
911 stars 58 forks source link

use of undeclared crate or module `naia_server_socket` ? #201

Open Luminoth opened 1 month ago

Luminoth commented 1 month ago

I'm not sure what exactly I'm doing wrong here, I'm trying to piece together how to use naia with bevy from the demo, so I've added this to my Cargo.toml:

naia-bevy-server = { version = "0.23", features = [
    "transport_udp",
] }
naia-bevy-shared = "0.23"

but when I go to build I get a bunch of errors from the dependencies:

   Compiling naia-bevy-shared v0.23.0
   Compiling naia-server v0.23.0
error[E0433]: failed to resolve: use of undeclared crate or module `naia_server_socket`
 --> /home/shane/.cargo/registry/src/index.crates.io-6f17d22bba15001f/naia-server-0.23.0/src/handshake/advanced_handshaker.rs:6:5
  |
6 | use naia_server_socket::shared::IdentityToken;
  |     ^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `naia_server_socket`

error[E0053]: method `listen` has an incompatible type for trait
  --> /home/shane/.cargo/registry/src/index.crates.io-6f17d22bba15001f/naia-server-0.23.0/src/transport/udp.rs:41:5
   |
41 |     fn listen(self: Box<Self>) -> (Box<dyn TransportSender>, Box<dyn TransportReceiver>) {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected a tuple with 4 elements, found one with 2 elements
   |
note: type in trait
  --> /home/shane/.cargo/registry/src/index.crates.io-6f17d22bba15001f/naia-server-0.23.0/src/transport/mod.rs:30:9
   |
30 | /         fn listen(
31 | |             self: Box<Self>,
32 | |         ) -> (
33 | |             Box<dyn AuthSender>,
...  |
36 | |             Box<dyn PacketReceiver>,
37 | |         );
   | |__________^
   = note: expected signature `fn(Box<_>) -> (Box<(dyn AuthSender + 'static)>, Box<(dyn AuthReceiver + 'static)>, Box<(dyn inner::PacketSender + 'static)>, Box<(dyn inner::PacketReceiver + 'static)>)`
              found signature `fn(Box<_>) -> (Box<(dyn inner::PacketSender + 'static)>, Box<(dyn inner::PacketReceiver + 'static)>)`

error[E0061]: this method takes 1 argument but 0 arguments were supplied
  --> /home/shane/.cargo/registry/src/index.crates.io-6f17d22bba15001f/naia-server-0.23.0/src/transport/conditioner.rs:53:28
   |
53 |         if self.time_queue.has_item() {
   |                            ^^^^^^^^-- argument #1 of type `&naia_shared::Instant` is missing
   |
note: method defined here
  --> /home/shane/.cargo/registry/src/index.crates.io-6f17d22bba15001f/naia-socket-shared-0.23.0/src/time_queue.rs:28:12
   |
28 |     pub fn has_item(&self, now: &Instant) -> bool {
   |            ^^^^^^^^
help: provide the argument
   |
53 |         if self.time_queue.has_item(/* &naia_shared::Instant */) {
   |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this method takes 1 argument but 0 arguments were supplied
  --> /home/shane/.cargo/registry/src/index.crates.io-6f17d22bba15001f/naia-server-0.23.0/src/transport/conditioner.rs:54:54
   |
54 |             let (address, payload) = self.time_queue.pop_item().unwrap();
   |                                                      ^^^^^^^^-- argument #1 of type `&naia_shared::Instant` is missing
   |
note: method defined here
  --> /home/shane/.cargo/registry/src/index.crates.io-6f17d22bba15001f/naia-socket-shared-0.23.0/src/time_queue.rs:43:12
   |
43 |     pub fn pop_item(&mut self, now: &Instant) -> Option<T> {
   |            ^^^^^^^^
help: provide the argument
   |
54 |             let (address, payload) = self.time_queue.pop_item(/* &naia_shared::Instant */).unwrap();
   |                                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Some errors have detailed explanations: E0053, E0061, E0433.
For more information about an error, try `rustc --explain E0053`.
error: could not compile `naia-server` (lib) due to 4 previous errors

Is there a step in here somewhere that I'm missing?

robertazzopardi commented 1 day ago

I've been getting similar errors too, trying to build the project.cargo build and cargo test result in: use of undeclared crate or module naia_server_socket