From 57dab4d15af47ae3fbd546c7146692601ea90aa5 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 15 Aug 2024 18:05:07 +0800 Subject: [PATCH] Rename `with_id`, `with_type_id` to `id`, `type_id`. (#153) --- crates/story/src/modal_story.rs | 2 +- crates/ui/src/notification.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/story/src/modal_story.rs b/crates/story/src/modal_story.rs index 71ef71e1..5cd4ab0c 100644 --- a/crates/story/src/modal_story.rs +++ b/crates/story/src/modal_story.rs @@ -501,7 +501,7 @@ impl Render for ModalStory { Notification::new( "你已经成功保存了文件,但是有一些警告信息需要你注意。", ) - .with_type_id::() + .type_id::() .title("保存成功") .icon(IconName::Inbox) .autohide(false) diff --git a/crates/ui/src/notification.rs b/crates/ui/src/notification.rs index 1323e495..82dc8d7c 100644 --- a/crates/ui/src/notification.rs +++ b/crates/ui/src/notification.rs @@ -100,7 +100,7 @@ impl Notification { } /// Set the id of the notification, used to uniquely identify the notification. - pub fn with_id(mut self, id: impl Into) -> Self { + pub fn id(mut self, id: impl Into) -> Self { let id: SharedString = id.into(); self.id = id.into(); self @@ -110,9 +110,9 @@ impl Notification { /// /// ```rs /// struct MyNotificationKind; - /// let notification = Notification::new("Hello").with_type_id::(); + /// let notification = Notification::new("Hello").type_id::(); /// ``` - pub fn with_type_id(mut self) -> Self { + pub fn type_id(mut self) -> Self { let type_id = TypeId::of::(); self.id = type_id.into(); self @@ -134,7 +134,7 @@ impl Notification { self } - pub fn with_type(mut self, type_: NotificationType) -> Self { + fn with_type(mut self, type_: NotificationType) -> Self { self.type_ = type_; self }