diff options
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/lib.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 50913ed8..ad1d910d 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -104,6 +104,7 @@ use rc::Ref; use std::cmp; use std::collections::HashMap; use std::ffi::{c_char, c_void, CStr}; +use std::fmt::{Display, Formatter}; use std::path::{Path, PathBuf}; use string::BnString; use string::IntoCStr; @@ -513,6 +514,20 @@ impl Ord for VersionInfo { } } +impl Display for VersionInfo { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + if self.channel.is_empty() { + write!(f, "{}.{}.{}", self.major, self.minor, self.build) + } else { + write!( + f, + "{}.{}.{}-{}", + self.major, self.minor, self.build, self.channel + ) + } + } +} + pub fn version_info() -> VersionInfo { let info_raw = unsafe { BNGetVersionInfo() }; VersionInfo::from_owned_raw(info_raw) |
