mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-08 09:19:53 +00:00
api-macro: JSONValue to bool shortcut
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
c21a44b16d
commit
d4721d77b7
@ -167,6 +167,14 @@ impl TryFrom<JSONValue> for syn::LitBool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Expect a json value to be a literal boolean:
|
||||||
|
impl TryFrom<JSONValue> for bool {
|
||||||
|
type Error = syn::Error;
|
||||||
|
fn try_from(value: JSONValue) -> Result<Self, syn::Error> {
|
||||||
|
Ok(syn::LitBool::try_from(value)?.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Expect a json value to be an identifier:
|
/// Expect a json value to be an identifier:
|
||||||
impl TryFrom<JSONValue> for Ident {
|
impl TryFrom<JSONValue> for Ident {
|
||||||
type Error = syn::Error;
|
type Error = syn::Error;
|
||||||
|
Loading…
Reference in New Issue
Block a user