Add deprecation hint to service name usages

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/9/head
trivernis 3 years ago
parent 903acc8845
commit c6aa3f97f4
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -16,15 +16,23 @@ impl BasicServiceInfo {
#[derive(Clone, Debug, Serialize, Deserialize, Hash, PartialOrd, PartialEq, Ord, Eq)]
pub enum ServiceIdentifier {
/// Try to avoid using this variant as it will be removed from the interface
/// in the future
Name(String),
/// The key variant of a service which should be the preferred variant.
Key(String),
}
impl ServiceIdentifier {
/// Deprecation: use [ServiceIdentifier::key] instead.
#[deprecated(
note = "Deprecation in the official interface was mentioned. Use the service keys instead."
)]
pub fn name<S: ToString>(name: S) -> Self {
Self::Name(name.to_string())
}
/// Constructs a new type of the key variant.
pub fn key<S: ToString>(key: S) -> Self {
Self::Key(key.to_string())
}

@ -19,6 +19,7 @@ async fn it_cleans_tags() {
#[tokio::test]
async fn it_adds_tags() {
#![allow(deprecated)]
let client = common::get_client();
let request = AddTagsRequestBuilder::default()
.add_hash("0000000000000000000000000000000000000000000000000000000000000000") // valid hash, I hope no files are affected

@ -26,6 +26,7 @@ async fn it_returns_url_information() {
#[tokio::test]
async fn it_adds_urls() {
#![allow(deprecated)]
let client = common::get_client();
let request = AddUrlRequestBuilder::default()
.url("https://www.pixiv.net/member_illust.php?illust_id=83406361&mode=medium")

Loading…
Cancel
Save