examples: use #[] in news_fetcher.v to simplify the code

pull/14007/head
Delyan Angelov 2022-04-10 11:11:53 +03:00
parent 88c4a64a15
commit 8517b8f8b0
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 2 additions and 5 deletions

View File

@ -30,13 +30,10 @@ fn main() {
println('failed to fetch data from /v0/topstories.json') println('failed to fetch data from /v0/topstories.json')
return return
} }
mut ids := json.decode([]int, resp.text) or { ids := json.decode([]int, resp.text) or {
println('failed to decode topstories.json') println('failed to decode topstories.json')
return return
} }#[0..10]
if ids.len > 10 {
ids = ids[0..10]
}
mut fetcher_pool := pool.new_pool_processor( mut fetcher_pool := pool.new_pool_processor(
callback: worker_fetch callback: worker_fetch
) )