py3/rust: types: add AsRef<str> for RepoPath

Summary:
In a future diff, I have RepoPath in Rust and want to send unicode path to
Python.

Reviewed By: sfilipco

Differential Revision: D19581184

fbshipit-source-id: 73a03707a6bdae4a497a8ee2c14314aa4ffefb6d
This commit is contained in:
Xavier Deguillard 2020-01-27 16:48:13 -08:00 committed by Facebook Github Bot
parent 41cd693b98
commit 789d2b5fbb

View File

@ -228,6 +228,12 @@ impl AsRef<RepoPath> for RepoPathBuf {
}
}
impl AsRef<str> for RepoPathBuf {
fn as_ref(&self) -> &str {
&self.0
}
}
impl AsRef<[u8]> for RepoPathBuf {
fn as_ref(&self) -> &[u8] {
self.as_byte_slice()
@ -359,6 +365,12 @@ impl AsRef<RepoPath> for RepoPath {
}
}
impl AsRef<str> for RepoPath {
fn as_ref(&self) -> &str {
&self.0
}
}
impl AsRef<[u8]> for RepoPath {
fn as_ref(&self) -> &[u8] {
self.as_byte_slice()