about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2012-08-25 16:36:02 -0700
committerNiko Matsakis <niko@alum.mit.edu>2012-08-27 14:10:54 -0700
commit1dc92d44be45f125265f98914dc3b5ee9b7e77a2 (patch)
tree2ee973c63d244cfa16196a01b9bf84b02923b331 /src
parent5d56da1678c00ccff2c4c680de3f2245deef172a (diff)
libcore: fix indention.
Diffstat (limited to 'src')
-rw-r--r--src/libcore/str.rs148
1 files changed, 74 insertions, 74 deletions
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index 6a9ba9ff6f6..d2e9ad6019b 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -1859,83 +1859,83 @@ mod unsafe {
     /// Converts a byte to a string.
     unsafe fn from_byte(u: u8) -> ~str { unsafe::from_bytes([u]) }
 
-   /**
-    * Takes a bytewise (not UTF-8) slice from a string.
-    *
-    * Returns the substring from [`begin`..`end`).
-    *
-    * # Failure
-    *
-    * If begin is greater than end.
-    * If end is greater than the length of the string.
-    */
-   unsafe fn slice_bytes(s: &str, begin: uint, end: uint) -> ~str {
-       do as_buf(s) |sbuf, n| {
-           assert (begin <= end);
-           assert (end <= n);
-
-           let mut v = ~[];
-           vec::reserve(v, end - begin + 1u);
-           unsafe {
-               do vec::as_buf(v) |vbuf, _vlen| {
-                   let src = ptr::offset(sbuf, begin);
-                   ptr::memcpy(vbuf, src, end - begin);
-               }
-               vec::unsafe::set_len(v, end - begin);
-               vec::push(v, 0u8);
-               ::unsafe::transmute(v)
-           }
-       }
-   }
-
-   /**
-    * Takes a bytewise (not UTF-8) view from a string.
-    *
-    * Returns the substring from [`begin`..`end`).
-    *
-    * # Failure
-    *
-    * If begin is greater than end.
-    * If end is greater than the length of the string.
-    */
-   #[inline]
-   unsafe fn view_bytes(s: &str, begin: uint, end: uint) -> &str {
-       do as_buf(s) |sbuf, n| {
+    /**
+     * Takes a bytewise (not UTF-8) slice from a string.
+     *
+     * Returns the substring from [`begin`..`end`).
+     *
+     * # Failure
+     *
+     * If begin is greater than end.
+     * If end is greater than the length of the string.
+     */
+    unsafe fn slice_bytes(s: &str, begin: uint, end: uint) -> ~str {
+        do as_buf(s) |sbuf, n| {
             assert (begin <= end);
             assert (end <= n);
 
-            let tuple = (ptr::offset(sbuf, begin), end - begin + 1);
-            ::unsafe::reinterpret_cast(tuple)
-       }
-   }
-
-   /// Appends a byte to a string. (Not UTF-8 safe).
-   unsafe fn push_byte(&s: ~str, b: u8) {
-       rustrt::rust_str_push(s, b);
-   }
-
-   /// Appends a vector of bytes to a string. (Not UTF-8 safe).
-   unsafe fn push_bytes(&s: ~str, bytes: ~[u8]) {
-       for vec::each(bytes) |byte| { rustrt::rust_str_push(s, byte); }
-   }
-
-   /// Removes the last byte from a string and returns it. (Not UTF-8 safe).
-   unsafe fn pop_byte(&s: ~str) -> u8 {
-       let len = len(s);
-       assert (len > 0u);
-       let b = s[len - 1u];
-       unsafe { set_len(s, len - 1u) };
-       return b;
-   }
-
-   /// Removes the first byte from a string and returns it. (Not UTF-8 safe).
-   unsafe fn shift_byte(&s: ~str) -> u8 {
-       let len = len(s);
-       assert (len > 0u);
-       let b = s[0];
-       s = unsafe { unsafe::slice_bytes(s, 1u, len) };
-       return b;
-   }
+            let mut v = ~[];
+            vec::reserve(v, end - begin + 1u);
+            unsafe {
+                do vec::as_buf(v) |vbuf, _vlen| {
+                    let src = ptr::offset(sbuf, begin);
+                    ptr::memcpy(vbuf, src, end - begin);
+                }
+                vec::unsafe::set_len(v, end - begin);
+                vec::push(v, 0u8);
+                ::unsafe::transmute(v)
+            }
+        }
+    }
+
+    /**
+     * Takes a bytewise (not UTF-8) view from a string.
+     *
+     * Returns the substring from [`begin`..`end`).
+     *
+     * # Failure
+     *
+     * If begin is greater than end.
+     * If end is greater than the length of the string.
+     */
+    #[inline]
+    unsafe fn view_bytes(s: &str, begin: uint, end: uint) -> &str {
+        do as_buf(s) |sbuf, n| {
+             assert (begin <= end);
+             assert (end <= n);
+
+             let tuple = (ptr::offset(sbuf, begin), end - begin + 1);
+             ::unsafe::reinterpret_cast(tuple)
+        }
+    }
+
+    /// Appends a byte to a string. (Not UTF-8 safe).
+    unsafe fn push_byte(&s: ~str, b: u8) {
+        rustrt::rust_str_push(s, b);
+    }
+
+    /// Appends a vector of bytes to a string. (Not UTF-8 safe).
+    unsafe fn push_bytes(&s: ~str, bytes: ~[u8]) {
+        for vec::each(bytes) |byte| { rustrt::rust_str_push(s, byte); }
+    }
+
+    /// Removes the last byte from a string and returns it. (Not UTF-8 safe).
+    unsafe fn pop_byte(&s: ~str) -> u8 {
+        let len = len(s);
+        assert (len > 0u);
+        let b = s[len - 1u];
+        unsafe { set_len(s, len - 1u) };
+        return b;
+    }
+
+    /// Removes the first byte from a string and returns it. (Not UTF-8 safe).
+    unsafe fn shift_byte(&s: ~str) -> u8 {
+        let len = len(s);
+        assert (len > 0u);
+        let b = s[0];
+        s = unsafe { unsafe::slice_bytes(s, 1u, len) };
+        return b;
+    }
 
     /// Sets the length of the string and adds the null terminator
     unsafe fn set_len(&v: ~str, new_len: uint) {