Skip to content

Implement ExternalValue#96

Draft
Caellian wants to merge 3 commits into
cel-rust:masterfrom
Caellian:dev/extern-types
Draft

Implement ExternalValue#96
Caellian wants to merge 3 commits into
cel-rust:masterfrom
Caellian:dev/extern-types

Conversation

@Caellian

Copy link
Copy Markdown
Contributor

This is initial implementation that adds support for abstract-types.

Not well tested (or at all).

I'm mostly creating this to provide an exhaustive example that compiles.

Could close #93 with some additional work, or be used for top level Value trait mentioned in #76.

@Caellian Caellian changed the title Implement ExternalValue (#93) Implement ExternalValue Oct 15, 2024
This is initial implementation. It's not well tested.

Signed-off-by: Tin Švagelj <[email protected]>
@Caellian

Caellian commented Oct 15, 2024

Copy link
Copy Markdown
Contributor Author

After reading through spec a little. Abstract values are opaque and their members can't be accessed. The added ExternalValue struct allows working in both opaque and non-opaque modes, so I just documented this distinction.

It will default to non-opaque mode if type implements AsValue. Otherwise, an opaque value can always be constructed.

Also, the drop logic I used is something I already tested in another crate with Miri, so it should work.

Oh, and CEL is designed for use with protobuf, so what #81 is doing might be a better fit. I'll probably fork off with these changes into a different crate if I get really invested in this because my use case calls for a lot of things that go against or aren't aligned with the spec.

@Caellian Caellian marked this pull request as draft October 17, 2024 16:54
@clarkmcc clarkmcc added the stale label Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generic abstract type support

2 participants