use std::borrow::Cow;
pub trait Module {
fn base_address(&self) -> u64;
fn size(&self) -> u64;
fn code_file(&self) -> Cow<str>;
fn code_identifier(&self) -> Cow<str>;
fn debug_file(&self) -> Option<Cow<str>>;
fn debug_identifier(&self) -> Option<Cow<str>>;
fn version(&self) -> Option<Cow<str>>;
}
impl<'a> Module for (&'a str, &'a str) {
fn base_address(&self) -> u64 { 0 }
fn size(&self) -> u64 { 0 }
fn code_file(&self) -> Cow<str> { Cow::Borrowed("") }
fn code_identifier(&self) -> Cow<str> { Cow::Borrowed("") }
fn debug_file(&self) -> Option<Cow<str>> {
let &(ref file, ref _id) = self;
Some(Cow::Borrowed(file))
}
fn debug_identifier(&self) -> Option<Cow<str>> {
let &(ref _file, ref id) = self;
Some(Cow::Borrowed(id))
}
fn version(&self) -> Option<Cow<str>> { None }
}