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 option object vec #326

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions other_custom_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,18 @@ impl CustomTypesContract {
pub fn tuple_strukt(_env: Env, tuple_strukt: TupleStruct) -> TupleStruct {
tuple_strukt
}

pub fn get_object_vec_option(env: Env) -> Option<Vec<Test>> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with other functions in this contract, we should drop the get_ prefix and use the same names as other functions here.

Suggested change
pub fn get_object_vec_option(env: Env) -> Option<Vec<Test>> {
pub fn option_vec_strukt(env: Env) -> Option<Vec<Test>> {

let obj: Test = Test {
a: 1,
b: true,
c: symbol_short!("hi"),
};
let obj2: Test = Test {
a: 2,
b: false,
c: symbol_short!("hello"),
};
Some(Vec::from_array(&env, [obj, obj2]))
}
}
Loading