feat: implement Display for Branch

This commit is contained in:
aviac 2023-10-25 21:08:13 +02:00
parent 1f9a43c648
commit 45271ef915
No known key found for this signature in database
GPG key ID: 644781002BDEA982
2 changed files with 9 additions and 18 deletions

View file

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

View file

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