You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to deal with json data encounter this, here is some test code.
let root = Request::new("https://api.dmzj.com/dynamic/comicinfo/40956.json",HttpMethod::Get).json().as_object()?;// two level get will make result emptylet infoNodeEmpty = root.get("data").as_object()?.get("info").as_object()?;check!(infoNodeEmpty);//check!(infoNode.get("id").as_string().read());let infoNodeOK = root
.get("data").as_object()?
.get("info").clone()// Add clone make this ok.as_object()?;check!(infoNodeOK);let dataNode = root.get("data");vcheck!(dataNode);// OKlet dataNodeCopy = root.get("data");let infoNode1 = dataNodeCopy.as_object()?.get("info");vcheck!(infoNode1);// Empty// Maybe this cause issue.let dataNodeObject = root.get("data").as_object()?;check!(dataNodeObject);
used marco
macro_rules! check {($e: expr) => {
println!("ObjectRef {}:{} is {}",
stringify!($e),
$e.rid(),
match $e.is_empty(){true => "Empty",
false => "OK",
});
};}macro_rules! vcheck {($e: expr) => {
println!("ValueRef {}:{} is {}",
stringify!($e),
$e.rid(),
match $e.is_none(){true => "Empty",
false => "OK",
})};}
The text was updated successfully, but these errors were encountered:
This is due to rust dropping a value that Aidoku needs to stay alive. I could fix this on Aidoku's side but it would mean more difficult memory management for any source language apart from rust, so ideally if there's a rust way to do it better that would be best.
When I try to deal with json data encounter this, here is some test code.
used marco
The text was updated successfully, but these errors were encountered: