godot-core 0.5.1

Internal crate used by godot-rust
Documentation
/*
 * Copyright (c) godot-rust; Bromeon and contributors.
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */

// ----------------------------------------------------------------------------------------------------------------------------------------------
// Compatibility

// Code generated by Rust derive macros cannot cause any deprecation warnings, due to questionable "feature"
// https://github.com/rust-lang/rust/pull/58994. Fortunately, an extra layer of indirection solves most problems: we generate a declarative
// macro that itself isn't deprecated, but _its_ expansion is. Since the expansion happens in a later step, the warning is emitted.

// Usage example.
//
// 1. Declare a const fn which describes the deprecation warning.
//
//     #[deprecated = "\n\
//         #[base] is no longer needed; Base<T> is recognized directly. \n\
//         More information on https://github.com/godot-rust/gdext/pull/577."]
//     pub const fn base_attribute() {}
//
// 2. At the place of usage, use the `emit_deprecated_warning!` macro to emit the warning.
//
//     #[cfg(feature = "custom-godot")]
//     __deprecated::emit_deprecated_warning!(base_attribute);
//
//   When used in generated code from proc-macros (effectively a way to cause compile-time warnings, even for other things than deprecations):
//
//     ::godot::__deprecated::emit_deprecated_warning!(base_attribute);

#[macro_export]
macro_rules! emit_deprecated_warning {
    ($warning_fn:ident) => {
        const _: () = $crate::__deprecated::$warning_fn();
    };
}

pub use crate::emit_deprecated_warning;

// ----------------------------------------------------------------------------------------------------------------------------------------------
// Library-side deprecations -- see usage description above.

#[deprecated = "\nUse `key => value` syntax in `vdict!` macro.\nOld syntax `key: value` will be removed."]
pub const fn vdict_colon_syntax() {}

// Virtual method renames (can be removed together with maybe_rename_deprecated_virtual() in godot-macros).
#[deprecated = "\n\
    Virtual method `get_property` has been renamed to `on_get`.\n\
    See https://github.com/godot-rust/gdext/pull/1527."]
pub const fn virtual_method_get_property() {}

#[deprecated = "\n\
    Virtual method `set_property` has been renamed to `on_set`.\n\
    See https://github.com/godot-rust/gdext/pull/1527."]
pub const fn virtual_method_set_property() {}

#[deprecated = "\n\
    Virtual method `validate_property` has been renamed to `on_validate_property`.\n\
    See https://github.com/godot-rust/gdext/pull/1527."]
pub const fn virtual_method_validate_property() {}

#[deprecated = "\n\
    Virtual method `get_property_list` has been renamed to `on_get_property_list`.\n\
    See https://github.com/godot-rust/gdext/pull/1527."]
pub const fn virtual_method_get_property_list() {}

#[deprecated = "\n\
    Virtual method `property_get_revert` has been renamed to `on_property_get_revert`.\n\
    See https://github.com/godot-rust/gdext/pull/1527."]
pub const fn virtual_method_property_get_revert() {}

// ----------------------------------------------------------------------------------------------------------------------------------------------
// Godot-side deprecations (we may mark them deprecated but keep support).

// Past removals: `radians` in #[export(range)].

#[deprecated = "\n\
    Signal names starting with `_` are discouraged in Rust.\n\
    Instead, use: `#[signal(internal)] fn my_signal();`\n\
    This registers it as `_my_signal`, effectively hiding it in Godot."]
pub const fn signal_underscore_prefix() {}