diff options
| author | Kevin Ballard <kevin@sb.org> | 2013-09-26 12:58:56 -0700 |
|---|---|---|
| committer | Kevin Ballard <kevin@sb.org> | 2013-10-15 20:10:11 -0700 |
| commit | 7fcdcaeda7c264cde63df79ce5d189d91567f70b (patch) | |
| tree | 3ce1aba6e9552f1019c129edf9cbeba60d7db99a /src/libstd | |
| parent | 33adf6dd6e0dd69af29ee11a1a7a2e11c998938c (diff) | |
| download | rust-7fcdcaeda7c264cde63df79ce5d189d91567f70b.tar.gz rust-7fcdcaeda7c264cde63df79ce5d189d91567f70b.zip | |
path2: Implement IterBytes for Path
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/path2/posix.rs | 8 | ||||
| -rw-r--r-- | src/libstd/path2/windows.rs | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/libstd/path2/posix.rs b/src/libstd/path2/posix.rs index 11579ba0956..9157243244e 100644 --- a/src/libstd/path2/posix.rs +++ b/src/libstd/path2/posix.rs @@ -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); diff --git a/src/libstd/path2/windows.rs b/src/libstd/path2/windows.rs index 2545ba8ada2..2ab8a2c0140 100644 --- a/src/libstd/path2/windows.rs +++ b/src/libstd/path2/windows.rs @@ -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`. /// |
