git.delta.rocks / jrsonnet / refs/commits / 11643ec5f009

difftreelog

source

crates/jrsonnet-evaluator/src/builtin/stdlib.rs669 Bsourcehistory
1use std::path::PathBuf;23use jrsonnet_parser::{LocExpr, ParserSettings};45thread_local! {6	/// To avoid parsing again when issued from the same thread7	#[allow(unreachable_code)]8	static PARSED_STDLIB: LocExpr = {9		#[cfg(feature = "serialized-stdlib")]10		{11			// Should not panic, stdlib.bincode is generated in build.rs12			return bincode::deserialize(include_bytes!(concat!(env!("OUT_DIR"), "/stdlib.bincode")))13				.unwrap();14		}1516		jrsonnet_parser::parse(17			jrsonnet_stdlib::STDLIB_STR,18			&ParserSettings {19				file_name: PathBuf::from("std.jsonnet").into(),20			},21		)22		.unwrap()23	}24}2526pub fn get_parsed_stdlib() -> LocExpr {27	PARSED_STDLIB.with(Clone::clone)28}