| Crates.io | astro-core |
| lib.rs | astro-core |
| version | 0.2.0 |
| created_at | 2025-12-09 22:00:17.164711+00 |
| updated_at | 2026-01-08 18:43:33.823312+00 |
| description | Rust wrapper around the Swiss Ephemeris C library to compute Sun, Moon, and Ascendant signs from UTC birth data. |
| homepage | https://github.com/volodymyrlekhman/astro-core |
| repository | https://github.com/volodymyrlekhman/astro-core |
| max_upload_size | |
| id | 1976821 |
| size | 1,880,946 |
Minimal Rust wrapper around the Swiss Ephemeris C library for computing Sun, Moon, and Ascendant signs from UTC birth data and location.
calculate_core_chart) returning Sun, Moon, and Ascendant signs.cc in build.rs.set_ephe_path); defaults to current dir.cargo build
cargo test # runs unit tests
cargo run --example basic
use astro_core::{calculate_core_chart, set_ephe_path, BirthData};
fn main() -> Result<(), Box<dyn std::error::Error>> {
set_ephe_path("src/swisseph/ephe"); // adjust if your ephemeris files live elsewhere
let birth = BirthData {
year: 1990,
month: 7,
day: 15,
hour: 10,
minute: 30,
second: 0.0,
lat: 40.7128,
lon: -74.0060,
};
let chart = calculate_core_chart(&birth)?;
println!("Sun: {}, Moon: {}, Asc: {}", chart.sun_sign, chart.moon_sign, chart.asc_sign);
Ok(())
}
If the birth time is unknown, you can use a date-only helper. It returns Sun
sign from the date and leaves Moon/Asc as None:
use astro_core::{calculate_core_chart_date_only, set_ephe_path, BirthDate, BirthLocation};
fn main() -> Result<(), Box<dyn std::error::Error>> {
set_ephe_path("src/swisseph/ephe");
let date = BirthDate {
year: 1990,
month: 7,
day: 15,
};
let location = BirthLocation {
lat: 40.7128,
lon: -74.0060,
};
let chart = calculate_core_chart_date_only(&date, &location)?;
println!(
"Sun: {:?}, Moon: {:?}, Asc: {:?}",
chart.sun_sign, chart.moon_sign, chart.asc_sign
);
Ok(())
}
src/swisseph and compiled automatically.set_ephe_path("/path/to/ephe").src/swisseph/LICENSE.cargo fmt, cargo clippy -- -D warnings.cargo run --example basic..warnings(false) in build.rs if needed.Volodymyr Lekhman — LinkedIn