add keys fn.

pull/1049/head
hiroaki.takeo 2019-06-24 18:29:54 +09:00 committed by Alex Medvednikov
parent 95201ffcd1
commit 35b15b9481
1 changed files with 9 additions and 0 deletions

View File

@ -108,6 +108,15 @@ pub fn (m mut map) sort() {
m.is_sorted = true m.is_sorted = true
} }
fn (m map) keys() []string {
mut keys := []string{}
for i := 0; i < m.entries.len; i++ {
entry := m.entries[i]
keys << entry.key
}
return keys
}
fn (m map) get(key string, out voidptr) bool { fn (m map) get(key string, out voidptr) bool {
if m.is_sorted { if m.is_sorted {
// println('\n\nget "$key" sorted') // println('\n\nget "$key" sorted')