Initializing vector

Hi Friends!

Suppose I need some pre-defined vector of constants in my smart-contract / object. How do I initialize it? By now I’m doing something which looks bit silly:

let amts = vector::singleton(30000000 as u64);
vector::push_back(&mut amts, 51000000);
vector::push_back(&mut amts, 34438300);
// ...

thanks in advance!

3 Likes

I am wondering the same! Let me know if you find a solution.

Vector literals (e.g., vector[1,2,3]) are the most efficient/ergonomic way to do this.