git.delta.rocks / jrsonnet / refs/commits / db326543f0fb

difftreelog

source

crates/nix-eval/src/lib.rs979 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;20// #[allow(non_upper_case_globals, non_camel_case_types, non_snake_case)]21// mod nix_raw {22// 	include!(concat!(env!("OUT_DIR"), "/bindings.rs"));23// }2425// fn init() {26// 	nix_raw::libutil_init();27// }2829#[derive(Clone)]30pub struct NixSession(pub(crate) Arc<tokio::sync::Mutex<PooledConnection<NixSessionPoolInner>>>);3132impl NixSession {33	fn ptr_eq(a: &Self, b: &Self) -> bool {34		Arc::ptr_eq(&a.0, &b.0)35	}36}3738pub fn init_tokio() {39	let _ = pool::TOKIO_RUNTIME.set(tokio::runtime::Handle::current());40}