Add Display impl for FQSN
This commit is contained in:
parent
8ceaa734d2
commit
fb0bf29826
@ -83,6 +83,19 @@ impl Fqsn {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Fqsn {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
let delim = "::";
|
||||||
|
let Fqsn { scopes } = self;
|
||||||
|
write!(f, "FQSN<{}", scopes[0])?;
|
||||||
|
for item in scopes[1..].iter() {
|
||||||
|
write!(f, "{}{}", delim, item)?;
|
||||||
|
}
|
||||||
|
write!(f, ">")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//TODO eventually this should use ItemId's to avoid String-cloning
|
//TODO eventually this should use ItemId's to avoid String-cloning
|
||||||
/// One segment within a scope.
|
/// One segment within a scope.
|
||||||
#[derive(Debug, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)]
|
#[derive(Debug, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)]
|
||||||
@ -90,6 +103,13 @@ enum Scope {
|
|||||||
Name(Rc<String>),
|
Name(Rc<String>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Scope {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
let Scope::Name(name) = self;
|
||||||
|
write!(f, "{}", name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum SymbolError {
|
pub enum SymbolError {
|
||||||
|
Loading…
Reference in New Issue
Block a user