path2: Implement IterBytes for Path
This commit is contained in:
parent
33adf6dd6e
commit
7fcdcaeda7
2 changed files with 16 additions and 0 deletions
|
|
@ -19,6 +19,7 @@ use iter::{AdditiveIterator, Extendable, Iterator};
|
|||
use option::{Option, None, Some};
|
||||
use str;
|
||||
use str::Str;
|
||||
use to_bytes::IterBytes;
|
||||
use util;
|
||||
use vec;
|
||||
use vec::CopyableVector;
|
||||
|
|
@ -75,6 +76,13 @@ impl ToCStr for Path {
|
|||
}
|
||||
}
|
||||
|
||||
impl IterBytes for Path {
|
||||
#[inline]
|
||||
fn iter_bytes(&self, lsb0: bool, f: &fn(buf: &[u8]) -> bool) -> bool {
|
||||
self.repr.iter_bytes(lsb0, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl GenericPathUnsafe for Path {
|
||||
unsafe fn from_vec_unchecked(path: &[u8]) -> Path {
|
||||
let path = Path::normalize(path);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ use iter::{AdditiveIterator, Extendable, Iterator};
|
|||
use option::{Option, Some, None};
|
||||
use str;
|
||||
use str::{OwnedStr, Str, StrVector};
|
||||
use to_bytes::IterBytes;
|
||||
use util;
|
||||
use vec::Vector;
|
||||
use super::{GenericPath, GenericPathUnsafe};
|
||||
|
|
@ -97,6 +98,13 @@ impl ToCStr for Path {
|
|||
}
|
||||
}
|
||||
|
||||
impl IterBytes for Path {
|
||||
#[inline]
|
||||
fn iter_bytes(&self, lsb0: bool, f: &fn(&[u8]) -> bool) -> bool {
|
||||
self.repr.iter_bytes(lsb0, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl GenericPathUnsafe for Path {
|
||||
/// See `GenericPathUnsafe::from_vec_unchecked`.
|
||||
///
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue