Skip to content

Commit

Permalink
fix(types): 解决 internal 可用区转换成字符串时的错误
Browse files Browse the repository at this point in the history
closed #28
  • Loading branch information
tu6ge committed Nov 16, 2023
1 parent 61333ab commit e98e4a2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,18 @@ impl AsRef<str> 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 { "" }
)
}
}

Expand Down

0 comments on commit e98e4a2

Please sign in to comment.