From e98e4a25193c952ee57a9a69fbf4011f8a285160 Mon Sep 17 00:00:00 2001 From: tu6ge Date: Thu, 16 Nov 2023 09:27:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(types):=20=E8=A7=A3=E5=86=B3=20internal=20?= =?UTF-8?q?=E5=8F=AF=E7=94=A8=E5=8C=BA=E8=BD=AC=E6=8D=A2=E6=88=90=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2=E6=97=B6=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closed #28 --- src/types.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/types.rs b/src/types.rs index 68fbb72..8d1a20d 100644 --- a/src/types.rs +++ b/src/types.rs @@ -337,10 +337,18 @@ impl AsRef for EndPoint { impl Display for EndPoint { /// ``` /// # use aliyun_oss_client::types::EndPoint; - /// assert_eq!(format!("{}", EndPoint::HANGZHOU), "cn-hangzhou"); + /// let mut endpoint = EndPoint::HANGZHOU; + /// assert_eq!(format!("{}", endpoint), "cn-hangzhou"); + /// endpoint.set_internal(true); + /// assert_eq!(format!("{}", endpoint), "cn-hangzhou-internal"); /// ``` fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.as_ref()) + write!( + f, + "{}{}", + self.as_ref(), + if self.is_internal { OSS_INTERNAL } else { "" } + ) } }