#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ToolInfo {
pub name: String,
pub version: String,
pub information_uri: String,
}
impl ToolInfo {
pub fn new(
name: impl Into<String>,
version: impl Into<String>,
information_uri: impl Into<String>,
) -> Self {
Self {
name: name.into(),
version: version.into(),
information_uri: information_uri.into(),
}
}
}
impl Default for ToolInfo {
fn default() -> Self {
Self::new(
"3329lens",
env!("CARGO_PKG_VERSION"),
"https://github.com/3329lens/3329lens",
)
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn default_is_3329lens() {
let t = ToolInfo::default();
assert_eq!(t.name, "3329lens");
assert_eq!(t.version, env!("CARGO_PKG_VERSION"));
assert_eq!(t.information_uri, "https://github.com/3329lens/3329lens");
}
}