var u = new URL('https://domain.site/php/search.php')
// console >
URL { href: "https://domain.site/php/search.php", origin: "https://domain.site", protocol: "https:", username: "", password: "", host: "domain.site", hostname: "domain.site", port: "", pathname: "/php/search.php", search: "" }
u.searchParams.set('a','first');
// console >
URL { href: "https://domain.site/php/search.php?a=first", origin: "https://domain.site", protocol: "https:", username: "", password: "", host: "domain.site", hostname: "domain.site", port: "", pathname: "/php/search.php", search: "?a=first" }
error[E0277]: a collection of type `std::vec::Vec<Candle>` cannot be built from an iterator over elements of type `std::result::Result<Candle, rusqlite::error::Error>`
--> src/lib.rs:47:9
|
47 | })?.collect();
| ^^^^^^^ a collection of type `std::vec::Vec<Candle>` cannot be built from `std::iter::Iterator<Item=std::result::Result<Candle, rusqlite::error::Error>>`
|
= help: the trait `std::iter::FromIterator<std::result::Result<Candle, rusqlite::error::Error>>` is not implemented for `std::vec::Vec<Candle>`
fn read()->Result<Vec<Candle>>{
let conn = Connection::open("candles.db")?;
let mut stmt = conn.prepare("SELECT * from candles")?;
let rows = stmt.query_map(params![], |row| {
Ok(Candle {
timestamp: row.get(1)?,
open: row.get(2)?,
close: row.get(3)?,
min: row.get(4)?,
max: row.get(5)?,
ticks: Vec::new()
})
})?;
let mut result:Vec<Candle> = Vec::new();
for row in rows{
result.push(row.unwrap());
}
Ok(result)
}
'{"auth": "true", "user": "ckmp", "status": "ok", "return_count": "1", "return": [{"id": "109", "situation_id": "3487", "datetime_add": "2019-03-19 07:27:47", "description": "\'test\'"}]}'
'{ ...
Но это, конечно же, сугубо мое личное мнение - я не профи