Implement &AnyString::as_as_str()
This commit is contained in:
parent
3db10a09bb
commit
28643fc2c2
@ -429,6 +429,17 @@ impl ToAsString for OneOrMany<&AnyString> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trait AsAsStr {
|
||||||
|
fn as_as_str(&self) -> Option<&str>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AsAsStr for &AnyString {
|
||||||
|
fn as_as_str(&self) -> Option<&str> {
|
||||||
|
self.as_xsd_string()
|
||||||
|
.or_else(|| self.as_rdf_lang_string().map(|ls| ls.value.as_str()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
Loading…
Reference in New Issue
Block a user