From 89feb6acdfd4928c7b7a6bc2b69e9a4cfcbb122c Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 1 Nov 2018 13:57:53 +0100 Subject: [PATCH] use refs in ApiMethod --- src/api_info.rs | 4 ++-- src/main.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/api_info.rs b/src/api_info.rs index 45863f84..e1262278 100644 --- a/src/api_info.rs +++ b/src/api_info.rs @@ -5,8 +5,8 @@ use serde_json::{Value}; pub struct ApiMethod { pub description: &'static str, - pub properties: StaticPropertyMap, - pub returns: Jss, + pub properties: &'static StaticPropertyMap, + pub returns: &'static Jss, pub handler: fn(Value) -> Result, } diff --git a/src/main.rs b/src/main.rs index cd5338f4..8a6186d6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -97,7 +97,7 @@ fn test_api_handler(param: Value) -> Result { static TEST_API_METHOD: ApiMethod = ApiMethod { description: "This is a simple test.", - properties: StaticPropertyMap { + properties: &StaticPropertyMap { entries: &[ ("force", Boolean!{ optional => Some(true), @@ -105,7 +105,7 @@ static TEST_API_METHOD: ApiMethod = ApiMethod { }) ] }, - returns: Jss::Null, + returns: &Jss::Null, handler: test_api_handler, };