git.delta.rocks / jrsonnet / refs/commits / 505f82ed3097

difftreelog

source

crates/nix-eval/src/lib.rs993 Bsourcehistory
1//! This whole library should be replaced with either binding to nix libexpr,2//! or with tvix (once it is able to build NixOS).3//!4//! Current api is awful, little effort was put into this implementation.56use std::sync::Arc;78pub use pool::NixSessionPool;9use pool::NixSessionPoolInner;10use r2d2::PooledConnection;11pub use session::{Error, Result};12pub use value::{Index, Value};1314mod pool;15mod session;16mod value;17// Contains macros helpers18#[doc(hidden)]19pub mod macros;20pub mod util;21// #[allow(non_upper_case_globals, non_camel_case_types, non_snake_case)]22// mod nix_raw {23// 	include!(concat!(env!("OUT_DIR"), "/bindings.rs"));24// }2526// fn init() {27// 	nix_raw::libutil_init();28// }2930#[derive(Clone)]31pub struct NixSession(pub(crate) Arc<tokio::sync::Mutex<PooledConnection<NixSessionPoolInner>>>);3233impl NixSession {34	fn ptr_eq(a: &Self, b: &Self) -> bool {35		Arc::ptr_eq(&a.0, &b.0)36	}37}3839pub fn init_tokio() {40	let _ = pool::TOKIO_RUNTIME.set(tokio::runtime::Handle::current());41}