libswe_sys/swerust/swe14/
handler.rs1use crate::raw;
2use std::ffi::{CStr, CString};
4use std::os::raw::c_int;
5
6pub fn house_name(hsys: char) -> String {
11 unsafe {
12 CString::from(CStr::from_ptr(raw::swe_house_name(hsys as c_int)))
13 .to_str()
14 .unwrap()
15 .to_string()
16 }
17}
18
19#[derive(Debug, Clone)]
20pub struct HousesResult {
21 pub cusps: Vec<f64>,
24 pub ascmc: [f64; 10],
25 pub result: i32,
26}
27
28pub fn houses(
29 tjd_ut: f64,
30 geolat: f64,
31 geolong: f64,
32 hsys: char,
33) -> HousesResult {
34 let mut cusps = [0.0; 37];
35 let mut ascmc = [0.0; 10];
36 let result: i32 = unsafe {
37 let p_cuspsw = cusps.as_mut_ptr();
38 let p_ascmc = ascmc.as_mut_ptr();
39 raw::swe_houses_ex(
40 tjd_ut,
41 0, geolat,
43 geolong,
44 hsys as c_int,
45 p_cuspsw,
46 p_ascmc,
47 )
48 };
49 HousesResult {
50 cusps: cusps.to_vec(),
51 ascmc,
52 result,
53 }
54}