sp_api_proc_macro/common.rs
1// This file is part of Substrate.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: Apache-2.0
5
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10// http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18/// The ident used for the block generic parameter.
19pub const BLOCK_GENERIC_IDENT: &str = "Block";
20
21/// The `core_trait` attribute.
22pub const CORE_TRAIT_ATTRIBUTE: &str = "core_trait";
23/// The `api_version` attribute.
24///
25/// Is used to set the current version of the trait.
26pub const API_VERSION_ATTRIBUTE: &str = "api_version";
27/// The `changed_in` attribute.
28///
29/// Is used when the function signature changed between different versions of a trait.
30/// This attribute should be placed on the old signature of the function.
31pub const CHANGED_IN_ATTRIBUTE: &str = "changed_in";
32/// The `renamed` attribute.
33///
34/// Is used when a trait method was renamed.
35pub const RENAMED_ATTRIBUTE: &str = "renamed";
36
37/// All attributes that we support in the declaration of a runtime api trait.
38pub const SUPPORTED_ATTRIBUTE_NAMES: &[&str] =
39 &[CORE_TRAIT_ATTRIBUTE, API_VERSION_ATTRIBUTE, CHANGED_IN_ATTRIBUTE, RENAMED_ATTRIBUTE];