wpilib_sys/
bindings.rs

1// Copyright 2018 First Rust Competition Developers.
2// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
3// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
4// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
5// option. This file may not be copied, modified, or distributed
6// except according to those terms.
7
8#![allow(non_snake_case)]
9#![allow(non_camel_case_types)]
10#![allow(dead_code)]
11#![allow(non_upper_case_globals)]
12#![allow(intra_doc_link_resolution_failure)]
13#![allow(clippy::useless_transmute)]
14#![allow(clippy::cast_lossless)]
15#![allow(clippy::trivially_copy_pass_by_ref)]
16
17use std::ffi;
18use std::fmt;
19
20include!("./hal_bindings.rs");
21
22impl fmt::Debug for HAL_JoystickDescriptor {
23    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
24        let name: Vec<_> = self.name.iter().map(|item| *item as u8).collect();
25        let name = &ffi::CString::new(name);
26        f.debug_struct("HAL_JoystickDescriptor")
27            .field("name", name)
28            .field("isXbox", &self.isXbox)
29            .field("axisCount", &self.axisCount)
30            .field("buttonCount", &self.buttonCount)
31            .field("povCount", &self.povCount)
32            .finish()
33    }
34}