Skip to content

Commit ec0fa5a

Browse files
feat(ffi): implement Display trait for NetworkInfo and remove to_string method
- Added implementation of the fmt::Display trait for NetworkInfo to provide a formatted string representation of the network. - Removed the redundant to_string method, streamlining the API and improving consistency in how network information is presented.
1 parent 26f5008 commit ec0fa5a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

dash-network-ffi/src/lib.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! FFI bindings for dash-network library
22
3+
use std::fmt;
4+
35
use dash_network::Network as DashNetwork;
46

57
// Initialize function
@@ -70,10 +72,6 @@ impl NetworkInfo {
7072
self.network.magic()
7173
}
7274

73-
pub fn to_string(&self) -> String {
74-
self.network.to_string()
75-
}
76-
7775
pub fn is_core_v20_active(&self, block_height: u32) -> bool {
7876
self.network.core_v20_is_active_at(block_height)
7977
}
@@ -83,6 +81,12 @@ impl NetworkInfo {
8381
}
8482
}
8583

84+
impl fmt::Display for NetworkInfo {
85+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
86+
self.network.fmt(f)
87+
}
88+
}
89+
8690
#[cfg(test)]
8791
mod tests {
8892
use super::*;

0 commit comments

Comments
 (0)