Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add complete support for constant dynamic collections #104

Merged
merged 1 commit into from
Sep 24, 2020

Conversation

udoprog
Copy link
Collaborator

@udoprog udoprog commented Sep 24, 2020

This adds supports for anonymous objects and tuples, like these:

const OBJECT = #{a: 42};
const TUPLE = (1, 2, 3);

I've also introduced runestick::Vec, which is a type-erased variant of a dynamic vector, essentially equivalent to Vec<Value>, but performs no conversion of its inner values and is capable of holding some associated methods useful for decoding inner values, like push_value and get_value:

let mut vec = runestick::Vec::new();

vec.push_value(42)?;
vec.push_value(true)?;

assert_eq!(Some(42), vec.get_value::<i64>(0)?);
assert_eq!(Some(true), vec.get_value::<bool>(1)?);
assert_eq!(None, vec.get_value::<bool>(2)?);

@udoprog udoprog added the enhancement New feature or request label Sep 24, 2020
@udoprog udoprog merged commit 5c76776 into master Sep 24, 2020
@udoprog udoprog deleted the const-collections branch September 24, 2020 16:11
@udoprog udoprog added the changelog Issue has been added to the changelog label Sep 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog Issue has been added to the changelog enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant