MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / Unwrap

Method Unwrap

codelab/network_functions.cc:368–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

366}
367
368absl::optional<NetworkAddressRep> NetworkAddressRep::Unwrap(
369 const cel::Value& value) {
370 auto opaque = value.AsOpaque();
371 if (!opaque.has_value() ||
372 opaque->GetTypeId() != cel::TypeId<NetworkAddressRep>()) {
373 return absl::nullopt;
374 }
375
376 // Note: safety depends on:
377 // 1) correctly implementing GetTypeId
378 // 2) the TypeId is unique
379 // 3) all calls to UnsafeOpaqueValue with the dispatcher provide the expected
380 // content type.
381 return opaque->content().To<NetworkAddressRep>();
382}
383
384absl::optional<NetworkAddressRep> NetworkAddressRep::Parse(
385 absl::string_view str) {

Callers

nothing calls this directly

Calls 5

AsOpaqueMethod · 0.45
has_valueMethod · 0.45
GetTypeIdMethod · 0.45
contentMethod · 0.45
interfaceMethod · 0.45

Tested by

no test coverage detected