[][src]Crate insim

InSim

This is a simple Rust implementation/generator of the LFS InSim protocol. It focuses on offering a good, strong basis for your InSim application, rather than being a full-featured, high-level crate. It is however simple to use (so simple you won't even need an example really if you understand how the InSim protocol works).

Network

This crate fully supports using TCP as the main and only way to transmit data between the LFS server/client and the application. It also supports UDP, but only as a secondary way to transmit high-frequency data such as NLP and MCI packets. In the second case, you must manually read the data coming from the UDP socket by using recv_udp rather than recv itself.

Modules

packets

All packets are defined in this file. Fields information for each packet have been omitted, as they have the same meaning as the official InSim C header file shipped with the LFS game and the dedicated server.

utils

This file contains utility functions used thorough the crate. For examples about how to use them, please refer to the tests at the end.

Structs

InSim

Represents a connection to a LFS host. It provides methods to send and receive packets to and from the server. Multiple instances can be made to this object at the same time.

OutGauge

Represents a connection to the LFS OutGauge client functionality. Used to gather precise information about the car, like RPM, turbo level and dash lights. This struct wraps the socket connection and orders the packets automatically.

Enums

Error

When the InSim fails to successfully connect to the server, either one of those values are returned.

Type Definitions

Result