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
#![feature(doc_cfg)]
#[cfg(feature = "macros")]
#[no_link]
#[allow(unused_imports)]
#[macro_use]
extern crate wll_macros;
#[doc(hidden)]
pub extern crate wll_sys as sys;
pub use complex::Complex;
pub use errors::{Error, ErrorKind};
#[cfg(feature = "macros")]
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
pub use wll_macros::*;
pub mod adaptor;
#[doc(hidden)]
pub mod global;
mod complex;
mod errors;
pub type Result<T> = std::result::Result<T, Error>;
#[inline]
pub fn message(msg: &'static str) -> Result<()> {
global::with_lib_data(|data| unsafe {
let func = (*data.as_ptr())
.Message
.unwrap_or_else(|| std::hint::unreachable_unchecked());
func(msg.as_ptr() as *const ::std::os::raw::c_char);
Ok(())
})
}
#[inline]
pub fn is_abort() -> Result<bool> {
global::with_lib_data(|data| unsafe {
Ok((*data.as_ptr())
.AbortQ
.unwrap_or_else(|| std::hint::unreachable_unchecked())()
!= 0)
})
}