#![allow(clippy::type_complexity)]
#![allow(rustdoc::bare_urls)]
#[cfg(not(feature = "python"))]
#[macro_use]
extern crate tracing;
#[cfg(feature = "python")]
#[macro_use]
extern crate log;
#[cfg(feature = "python")]
#[macro_use]
extern crate macro_rules_attribute;
#[macro_use]
extern crate serde;
#[cfg(feature = "_rustls-tls")]
pub(crate) type HttpsConnector =
hyper_rustls::HttpsConnector<hyper_util::client::legacy::connect::HttpConnector>;
#[cfg(feature = "_native-tls")]
pub(crate) type HttpsConnector =
hyper_tls::HttpsConnector<hyper_util::client::legacy::connect::HttpConnector>;
pub mod client;
pub mod error;
pub mod http;
pub mod model;
pub mod node;
pub mod player_context;
pub mod prelude;
#[cfg(feature = "macros")]
pub mod macros {
pub use macros_dep::hook;
}
#[cfg(feature = "macros")]
pub use macros::hook;
#[cfg(feature = "python")]
use pyo3::{prelude::*, types::PyDict, wrap_pymodule};
#[cfg(feature = "python")]
mod python;
#[cfg(feature = "python")]
#[pymodule]
fn lavalink_rs(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
let handle = pyo3_log::Logger::new(py, pyo3_log::Caching::LoggersAndLevels)?
.filter(log::LevelFilter::Trace)
.install()
.expect("Someone installed a logger before lavalink_rs.");
handle.reset();
m.add_class::<client::LavalinkClient>()?;
m.add_class::<player_context::PlayerContext>()?;
m.add_class::<python::event::EventHandler>()?;
m.add_class::<python::http::Http>()?;
m.add_class::<python::node::Node>()?;
m.add_class::<node::NodeBuilder>()?;
m.add_class::<python::model::client::NodeDistributionStrategyPy>()?;
m.add_class::<player_context::TrackInQueue>()?;
m.add_class::<player_context::QueueRef>()?;
m.add_class::<model::UserId>()?;
m.add_class::<model::ChannelId>()?;
m.add_class::<model::GuildId>()?;
m.add_wrapped(wrap_pymodule!(python::model::model))?;
let sys = PyModule::import(py, "sys")?;
let raw_modules = sys.getattr("modules")?;
let sys_modules: &Bound<'_, PyDict> = raw_modules.downcast()?;
sys_modules.set_item("lavalink_rs.model", m.getattr("model")?)?;
Ok(())
}