1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//! Here’s a simple example to get you started. This program makes your robot
//! move upward, uses the radar module to locate an enemy robot, and then fires
//! a component towards it. The `#![allow(unused_must_use)]` attribute is used to
//! suppress warnings about unused results from certain function calls.
//!
//! ```rust
//! // usr_main.rs
//! #![allow(unused_must_use)]
//! use rbot;
//!
//! pub fn main() {
//! // Move the robot upward with the specified velocity
//! rbot::velocity(0.0, 1.0, 1.0);
//!
//! // Wait for the Radar module to become available
//! rbot::modules::await_module(rbot::modules::Module::Radar);
//!
//! // Retrieve the radar message, which contains the position of the enemy robot
//! let radar_msg = rbot::modules::radar().expect("failed to get radar message");
//!
//! // Convert the enemy's position (x, y coordinates) to an angle
//! let angle = rbot::conversions::xy_to_angle(radar_msg.x, radar_msg.y);
//!
//! // Aim at the enemy robot using the calculated angle
//! rbot::await_aim(2, angle, 0.5);
//!
//! // Wait for the component to be ready
//! rbot::await_component(2);
//!
//! // Fire the component towards the enemy robot
//! rbot::use_component(2, false);
//! }
//! ```
//!
//! For more detailed documentation, please visit our Discord channel,
//! accessible through our website:
//! [https://botbeats.net](https://botbeats.net). If you have any questions,
//! feel free to reach out to us on Discord.
pub use crate*;
pub use messages;
/// Allocates a memory buffer in the robot's sandbox environment for storing
/// data from the host environment.
///
/// This function provides an interface for the host environment to allocate a
/// memory buffer within the robot's sandbox environment. The allocated buffer
/// is initialized with zeros and can be used to store data passed from the host
/// environment to the robot's runtime.
///
/// # Safety
///
/// This function is marked as `unsafe` because it involves direct manipulation
/// of memory pointers and relies on external interactions with the robot's
/// sandbox environment.
///
/// # Arguments
///
/// * `size` - The size of the memory buffer to allocate in bytes.
///
/// # Returns
///
/// An integer representing the pointer to the allocated memory buffer within
/// the robot's sandbox environment.
pub extern "C"
/// Prevents Rust compiler optimizations that could hinder robot booting.
pub extern "C"