ibc_types_core_client/client_type.rs
1use crate::prelude::*;
2use core::fmt::{Display, Error as FmtError, Formatter};
3
4/// Type of the client, depending on the specific consensus algorithm.
5#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
6pub struct ClientType(pub String);
7
8impl ClientType {
9 pub fn new(s: String) -> Self {
10 Self(s)
11 }
12
13 /// Yields this identifier as a borrowed `&str`
14 pub fn as_str(&self) -> &str {
15 &self.0
16 }
17}
18
19impl Display for ClientType {
20 fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
21 write!(f, "{}", self.0)
22 }
23}