feat: implement Display for SshUrl

This commit is contained in:
aviac 2023-09-22 19:59:47 +02:00
parent f97eb735fb
commit 030de8f9f8
No known key found for this signature in database
GPG key ID: 644781002BDEA982
2 changed files with 8 additions and 1 deletions

View file

@ -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"]

View file

@ -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;