mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-26 13:31:02 +00:00
Implement &AnyString::as_as_str()
This commit is contained in:
parent
3db10a09bb
commit
28643fc2c2
1 changed files with 11 additions and 0 deletions
|
@ -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)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Reference in a new issue