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

difftreelog

source

crates/jrsonnet-evaluator/src/builtin/stdlib.rs669 Bsourcehistory
1use jrsonnet_parser::{LocExpr, ParserSettings};2use std::path::PathBuf;34thread_local! {5	/// To avoid parsing again when issued from the same thread6	#[allow(unreachable_code)]7	static PARSED_STDLIB: LocExpr = {8		#[cfg(feature = "serialized-stdlib")]9		{10			// Should not panic, stdlib.bincode is generated in build.rs11			return bincode::deserialize(include_bytes!(concat!(env!("OUT_DIR"), "/stdlib.bincode")))12				.unwrap();13		}1415		jrsonnet_parser::parse(16			jrsonnet_stdlib::STDLIB_STR,17			&ParserSettings {18				file_name: PathBuf::from("std.jsonnet").into(),19			},20		)21		.unwrap()22	}23}2425pub fn get_parsed_stdlib() -> LocExpr {26	PARSED_STDLIB.with(|t| t.clone())27}