From 45271ef9157d349c39bc3d0c6d9435d61ec7524b Mon Sep 17 00:00:00 2001 From: aviac Date: Wed, 25 Oct 2023 21:08:13 +0200 Subject: [PATCH] feat: implement Display for Branch --- Cargo.toml | 2 +- src/types/api/branch.rs | 25 ++++++++----------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5e972a8..55fd63e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forgejo-api-types" -version = "0.1.9" +version = "0.1.10" edition = "2021" license = "AGPL-3.0-or-later" keywords = ["forgejo", "types", "codeberg", "api"] diff --git a/src/types/api/branch.rs b/src/types/api/branch.rs index d25e049..a19af5f 100644 --- a/src/types/api/branch.rs +++ b/src/types/api/branch.rs @@ -1,20 +1,5 @@ -// [Branch{ -// description: -// Branch represents a repository branch -// -// commit PayloadCommit{...} -// effective_branch_protection_name string -// enable_status_check boolean -// name string -// protected boolean -// required_approvals integer($int64) -// status_check_contexts [ -// x-go-name: StatusCheckContexts -// string] -// user_can_merge boolean -// user_can_push boolean -// }] -// +use std::fmt::Display; + use serde::{Deserialize, Serialize}; use crate::types::api::payload_commit::PayloadCommit; @@ -46,6 +31,12 @@ pub struct Branch { pub user_can_push: CanPush, } +impl Display for Branch { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.name) + } +} + #[cfg(test)] mod tests { #[test]