From b4b022940b908d8fe490b9f4f68bc60dcfb76cd2 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Mon, 19 Dec 2022 01:16:35 +0100 Subject: Syntax and example sections --- src/model/func.rs | 6 ++++++ src/model/library.rs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src/model') diff --git a/src/model/func.rs b/src/model/func.rs index 46befd77..fb8b3dd0 100644 --- a/src/model/func.rs +++ b/src/model/func.rs @@ -214,6 +214,10 @@ pub struct FuncInfo { pub tags: &'static [&'static str], /// Documentation for the function. pub docs: &'static str, + /// The source code of an example, if any. + pub example: Option<&'static str>, + /// Documentation about this function's syntax, if it has syntax. + pub syntax: Option<&'static str>, /// Details about the function's parameters. pub params: Vec, } @@ -232,6 +236,8 @@ pub struct ParamInfo { pub name: &'static str, /// Documentation for the parameter. pub docs: &'static str, + /// The source code of an example, if any. + pub example: Option<&'static str>, /// Valid values for the parameter. pub cast: CastInfo, /// Is the parameter positional? diff --git a/src/model/library.rs b/src/model/library.rs index 83310610..8b767b0e 100644 --- a/src/model/library.rs +++ b/src/model/library.rs @@ -122,7 +122,7 @@ pub static LANG_ITEMS: OnceCell = OnceCell::new(); /// break incremental, but only when different sets of lang items are used in /// the same program. For this reason, if this function is called multiple /// times, the items must be the same. -pub(crate) fn set_lang_items(items: LangItems) { +pub fn set_lang_items(items: LangItems) { if let Err(items) = LANG_ITEMS.set(items) { let first = hash128(LANG_ITEMS.get().unwrap()); let second = hash128(&items); -- cgit v1.2.3