From 030de8f9f8801c501e6ff981ec6c6aacec153bb4 Mon Sep 17 00:00:00 2001 From: aviac Date: Fri, 22 Sep 2023 19:59:47 +0200 Subject: [PATCH] feat: implement Display for SshUrl --- Cargo.toml | 2 +- src/types/misc/sshurl.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 4546b59..4d76e79 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forgejo-api-types" -version = "0.1.0" +version = "0.1.1" edition = "2021" license = "AGPL-3.0-or-later" keywords = ["forgejo", "types", "codeberg", "api"] diff --git a/src/types/misc/sshurl.rs b/src/types/misc/sshurl.rs index c6bd207..9b24cec 100644 --- a/src/types/misc/sshurl.rs +++ b/src/types/misc/sshurl.rs @@ -1,3 +1,4 @@ +use std::fmt::Display; use std::str::FromStr; use serde::de::{Deserializer, Error, Visitor}; @@ -11,6 +12,12 @@ pub struct SshUrl { url: Url, } +impl Display for SshUrl { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}@{}", self.prefix, self.url) + } +} + impl FromStr for SshUrl { type Err = String;