Skip to main content

deprecation_message

Function deprecation_message 

Source
pub fn deprecation_message(
    name: &str,
    start_date: Option<&str>,
    remove_date: Option<&str>,
    message: Option<&str>,
) -> String
Expand description

The warning music21’s deprecated gives the first time a deprecated function is called: when it was deprecated, when it goes, and what to do instead, each with music21’s wording where it is not given.

use music21::common::decorators::deprecation_message;

assert_eq!(
    deprecation_message("hi", None, None, None),
    "hi was deprecated and will disappear soon. Find alternative methods."
);
assert_eq!(
    deprecation_message("bye", Some("February 1972"), Some("September 2099"), Some("You should be okay.")),
    "bye was deprecated on February 1972 and will disappear at or after September 2099. You should be okay."
);