Added some notes about observed behavior and fixed return types for missing/absent keys.

This commit is contained in:
Tom Alexander
2020-06-14 14:13:33 -04:00
parent 69fa266692
commit 716a110d2e
4 changed files with 18 additions and 4 deletions

View File

@@ -733,7 +733,12 @@ impl<'a> DustRenderer<'a> {
.map(|ce| ce.get_size())
});
match value_ce {
None | Some(Err(_)) | Some(Ok(None)) => return Ok("".to_owned()),
// If we found the key but could not get the size from it, render nothing.
Some(Ok(None)) => return Ok("".to_owned()),
// If "key" is not on the @size tag at all, render 0.
None => return Ok("0".to_owned()),
// If the key value could not be found in the context, render 0.
Some(Err(_)) => return Ok("0".to_owned()),
Some(Ok(Some(ce_size))) => {
return ce_size.get_context_element_reference().render(&Vec::new())
}