Override clone_from
method for PathBuf and OsString
This commit is contained in:
parent
dc8cb63078
commit
4a8671a2fa
3 changed files with 39 additions and 3 deletions
|
@ -14,7 +14,7 @@ use crate::sys_common::{AsInner, FromInner, IntoInner};
|
|||
|
||||
use core::str::lossy::Utf8Lossy;
|
||||
|
||||
#[derive(Clone, Hash)]
|
||||
#[derive(Hash)]
|
||||
pub(crate) struct Buf {
|
||||
pub inner: Vec<u8>,
|
||||
}
|
||||
|
@ -53,6 +53,18 @@ impl fmt::Display for Buf {
|
|||
}
|
||||
}
|
||||
|
||||
impl Clone for Buf {
|
||||
#[inline]
|
||||
fn clone(&self) -> Self {
|
||||
Buf { inner: self.inner.clone() }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn clone_from(&mut self, source: &Self) {
|
||||
self.inner.clone_from(&source.inner)
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoInner<Vec<u8>> for Buf {
|
||||
fn into_inner(self) -> Vec<u8> {
|
||||
self.inner
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue