use refs in ApiMethod

This commit is contained in:
Dietmar Maurer 2018-11-01 13:57:53 +01:00
parent b90dcc34bb
commit 89feb6acdf
2 changed files with 4 additions and 4 deletions

View File

@ -5,8 +5,8 @@ use serde_json::{Value};
pub struct ApiMethod { pub struct ApiMethod {
pub description: &'static str, pub description: &'static str,
pub properties: StaticPropertyMap, pub properties: &'static StaticPropertyMap,
pub returns: Jss, pub returns: &'static Jss,
pub handler: fn(Value) -> Result<Value, Error>, pub handler: fn(Value) -> Result<Value, Error>,
} }

View File

@ -97,7 +97,7 @@ fn test_api_handler(param: Value) -> Result<Value, Error> {
static TEST_API_METHOD: ApiMethod = ApiMethod { static TEST_API_METHOD: ApiMethod = ApiMethod {
description: "This is a simple test.", description: "This is a simple test.",
properties: StaticPropertyMap { properties: &StaticPropertyMap {
entries: &[ entries: &[
("force", Boolean!{ ("force", Boolean!{
optional => Some(true), optional => Some(true),
@ -105,7 +105,7 @@ static TEST_API_METHOD: ApiMethod = ApiMethod {
}) })
] ]
}, },
returns: Jss::Null, returns: &Jss::Null,
handler: test_api_handler, handler: test_api_handler,
}; };