1#![allow(non_upper_case_globals)]
2#![allow(non_camel_case_types)]
3#![allow(non_snake_case)]
4
5#[cfg(all(feature = "doubleprecision", feature = "instance"))]
6include!("./ffi-instance-doubleprecision.rs");
7#[cfg(all(feature = "doubleprecision", not(feature = "instance")))]
8include!("./ffi-doubleprecision.rs");
9#[cfg(all(not(feature = "doubleprecision"), feature = "instance"))]
10include!("./ffi-instance.rs");
11#[cfg(not(any(feature = "doubleprecision", feature = "instance")))]
12include!("./ffi.rs");
13
14use std::fmt;
15
16impl fmt::Display for &mut crate::_symbol {
17 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
18 unsafe {
19 let c = std::ffi::CStr::from_ptr(self.s_name);
20 if let Ok(c) = c.to_str() {
21 write!(f, "{}", c)
22 } else {
23 Err(std::fmt::Error {})
24 }
25 }
26 }
27}
28
29impl std::convert::From<std::ffi::CString> for &mut crate::_symbol {
30 fn from(s: std::ffi::CString) -> Self {
31 unsafe {
32 let s = crate::gensym(s.as_ptr());
33 &mut *s
34 }
35 }
36}
37
38impl std::convert::From<std::ffi::CString> for &crate::_symbol {
39 fn from(s: std::ffi::CString) -> Self {
40 unsafe {
41 let s = crate::gensym(s.as_ptr());
42 &*s
43 }
44 }
45}
46
47impl crate::_symbol {
48 pub fn as_ptr(&mut self) -> *mut crate::_symbol {
49 self as *mut crate::_symbol
50 }
51}
52
53impl std::cmp::PartialEq for crate::_symbol {
54 fn eq(&self, other: &Self) -> bool {
55 let s = self as *const _;
56 let o = other as *const _;
57 s == o
58 }
59}
60
61impl std::cmp::Eq for crate::_symbol {}