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

difftreelog

source

crates/jrsonnet-evaluator/src/stdlib/expr.rs683 Bsourcehistory
1use std::borrow::Cow;23use jrsonnet_parser::{LocExpr, ParserSettings, Source};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: Source::new_virtual(Cow::Borrowed("<std>")),20			},21		)22		.unwrap()23	}24}2526pub fn get_parsed_stdlib() -> LocExpr {27	PARSED_STDLIB.with(Clone::clone)28}