From 158219944c28640b130c5f07aa9522e1567bd9b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dj8yf0=CE=BCl?= Date: Tue, 25 Feb 2025 20:26:23 +0200 Subject: [PATCH] comment: resolves https://github.com/near/near-sdk-rs/pull/1313#issuecomment-2682263612 --- near-sdk-macros/src/lib.rs | 37 -------------------------------- near-sdk/src/near_annotations.rs | 27 +++++++++++++---------- 2 files changed, 16 insertions(+), 48 deletions(-) diff --git a/near-sdk-macros/src/lib.rs b/near-sdk-macros/src/lib.rs index a6a257dd8..0a4f4e0cb 100644 --- a/near-sdk-macros/src/lib.rs +++ b/near-sdk-macros/src/lib.rs @@ -374,43 +374,6 @@ pub fn ext_contract(attr: TokenStream, item: TokenStream) -> TokenStream { } } -// The below attributes a marker-attributes and therefore they are no-op. - -/// `callback` is a marker attribute it does not generate code by itself. -#[proc_macro_attribute] -#[deprecated(since = "4.0.0", note = "Case is handled internally by macro, no need to import")] -pub fn callback(_attr: TokenStream, item: TokenStream) -> TokenStream { - item -} - -/// `callback_args_vec` is a marker attribute it does not generate code by itself. -#[deprecated(since = "4.0.0", note = "Case is handled internally by macro, no need to import")] -#[proc_macro_attribute] -pub fn callback_vec(_attr: TokenStream, item: TokenStream) -> TokenStream { - item -} - -/// `serializer` is a marker attribute it does not generate code by itself. -#[deprecated(since = "4.0.0", note = "Case is handled internally by macro, no need to import")] -#[proc_macro_attribute] -pub fn serializer(_attr: TokenStream, item: TokenStream) -> TokenStream { - item -} - -/// `result_serializer` is a marker attribute it does not generate code by itself. -#[deprecated(since = "4.0.0", note = "Case is handled internally by macro, no need to import")] -#[proc_macro_attribute] -pub fn result_serializer(_attr: TokenStream, item: TokenStream) -> TokenStream { - item -} - -/// `init` is a marker attribute it does not generate code by itself. -#[deprecated(since = "4.0.0", note = "Case is handled internally by macro, no need to import")] -#[proc_macro_attribute] -pub fn init(_attr: TokenStream, item: TokenStream) -> TokenStream { - item -} - #[cfg(feature = "abi")] #[derive(darling::FromDeriveInput, Debug)] #[darling(attributes(abi), forward_attrs(serde, borsh_skip, schemars, validate))] diff --git a/near-sdk/src/near_annotations.rs b/near-sdk/src/near_annotations.rs index 1dca4a56c..fb16d0254 100644 --- a/near-sdk/src/near_annotations.rs +++ b/near-sdk/src/near_annotations.rs @@ -3,18 +3,20 @@ //! This is not a real module; here we document the attributes that [`#[near]`](crate::near) //! and [`#[near_bindgen]`](crate::near_bindgen) macro use. //! -//! `near_bindgen` and `near_sdk` shares almost the same attributes: -//! * init -//! * payable -//! * private -//! * handle_result -//! * event_json -//! * contract_metadata -//! * serializer +//! `near_bindgen` and `near_sdk` share most of the attributes: +//! * `init` +//! * `payable` +//! * `private` +//! * `handle_result` +//! * `callback_unwrap` +//! * `event_json` +//! * `contract_metadata` +//! * `serializer` +//! * `result_serializer` //! -//! These attributes are only part of the `near` macro. -//! * serializers -//! * contract_state +//! Following attributes are only part of the `near` macro: +//! * `serializers` +//! * `contract_state` /// See [`near_sdk::near #[init]`](crate::near#init-annotates-methods-of-a-type-in-its-impl-block) pub fn init() {} @@ -31,6 +33,9 @@ pub fn result_serializer() {} /// See [`near_sdk::near #[handle_result]`](crate::near#handle_result-annotates-methods-of-a-type-in-its-impl-block) pub fn handle_result() {} +/// See [`near_sdk::near #[callback_unwrap]`](crate::near#callback_unwrap-annotates-function-arguments) +pub fn callback_unwrap() {} + /// See [`near_sdk::near #[near(event_json(...))]`](crate::near#nearevent_json-annotates-enums) pub fn event_json() {}