| 33 | namespace cel { |
| 34 | |
| 35 | void RegisterStandardExtensions(EnvRuntime& env_runtime) { |
| 36 | env_internal::RuntimeExtensionRegistry& registry = |
| 37 | env_runtime.GetRuntimeExtensionRegistry(); |
| 38 | registry.AddFunctionRegistration( |
| 39 | "cel.lib.ext.bindings", "bindings", 0, |
| 40 | [](RuntimeBuilder& runtime_builder, |
| 41 | const RuntimeOptions& runtime_options) -> absl::Status { |
| 42 | // No runtime functions to register. |
| 43 | return absl::OkStatus(); |
| 44 | }); |
| 45 | |
| 46 | registry.AddFunctionRegistration( |
| 47 | "cel.lib.ext.encoders", "encoders", 0, |
| 48 | [](RuntimeBuilder& runtime_builder, |
| 49 | const RuntimeOptions& runtime_options) -> absl::Status { |
| 50 | return cel::extensions::RegisterEncodersFunctions( |
| 51 | runtime_builder.function_registry(), runtime_options); |
| 52 | }); |
| 53 | |
| 54 | for (int version = 0; version <= extensions::kListsExtensionLatestVersion; |
| 55 | ++version) { |
| 56 | registry.AddFunctionRegistration( |
| 57 | "cel.lib.ext.lists", "lists", version, |
| 58 | [version](RuntimeBuilder& runtime_builder, |
| 59 | const RuntimeOptions& runtime_options) -> absl::Status { |
| 60 | return cel::extensions::RegisterListsFunctions( |
| 61 | runtime_builder.function_registry(), runtime_options, version); |
| 62 | }); |
| 63 | } |
| 64 | |
| 65 | for (int version = 0; version <= extensions::kMathExtensionLatestVersion; |
| 66 | ++version) { |
| 67 | registry.AddFunctionRegistration( |
| 68 | "cel.lib.ext.math", "math", version, |
| 69 | [version](RuntimeBuilder& runtime_builder, |
| 70 | const RuntimeOptions& runtime_options) -> absl::Status { |
| 71 | return cel::extensions::RegisterMathExtensionFunctions( |
| 72 | runtime_builder.function_registry(), runtime_options, version); |
| 73 | }); |
| 74 | } |
| 75 | |
| 76 | for (int version = 0; version <= cel::kOptionalExtensionLatestVersion; |
| 77 | ++version) { |
| 78 | registry.AddFunctionRegistration( |
| 79 | "cel.lib.ext.optional", "optional", version, |
| 80 | [](RuntimeBuilder& runtime_builder, |
| 81 | const RuntimeOptions& runtime_options) -> absl::Status { |
| 82 | return cel::extensions::EnableOptionalTypes(runtime_builder); |
| 83 | }); |
| 84 | } |
| 85 | |
| 86 | registry.AddFunctionRegistration( |
| 87 | "cel.lib.ext.protos", "protos", 0, |
| 88 | [](RuntimeBuilder& runtime_builder, |
| 89 | const RuntimeOptions& runtime_options) -> absl::Status { |
| 90 | // No runtime functions to register. |
| 91 | return absl::OkStatus(); |
| 92 | }); |
nothing calls this directly
no test coverage detected