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
#![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #[cfg(all(feature = "doubleprecision", feature = "instance"))] include!("./ffi-instance-doubleprecision.rs"); #[cfg(all(feature = "doubleprecision", not(feature = "instance")))] include!("./ffi-doubleprecision.rs"); #[cfg(all(not(feature = "doubleprecision"), feature = "instance"))] include!("./ffi-instance.rs"); #[cfg(not(any(feature = "doubleprecision", feature = "instance")))] include!("./ffi.rs"); use std::fmt; impl fmt::Display for &mut crate::_symbol { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { unsafe { let c = std::ffi::CStr::from_ptr(self.s_name); if let Ok(c) = c.to_str() { write!(f, "{}", c) } else { Err(std::fmt::Error {}) } } } } impl std::convert::From<std::ffi::CString> for &mut crate::_symbol { fn from(s: std::ffi::CString) -> Self { unsafe { let s = crate::gensym(s.as_ptr()); &mut *s } } } impl std::convert::From<std::ffi::CString> for &crate::_symbol { fn from(s: std::ffi::CString) -> Self { unsafe { let s = crate::gensym(s.as_ptr()); &*s } } } impl crate::_symbol { pub fn as_ptr(&mut self) -> *mut crate::_symbol { self as *mut crate::_symbol } } impl std::cmp::PartialEq for crate::_symbol { fn eq(&self, other: &Self) -> bool { let s = self as *const _; let o = other as *const _; s == o } } impl std::cmp::Eq for crate::_symbol {}