examples: use #[] in news_fetcher.v to simplify the code
parent
88c4a64a15
commit
8517b8f8b0
|
@ -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
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue