Skip to content

Commit ee8365a

Browse files
committed
Make std::ascii::ASCII_{UPPER,LOWER}_MAP public.
1 parent 29cb959 commit ee8365a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/libstd/ascii.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -400,12 +400,12 @@ pub trait StrAsciiExt {
400400
impl<'a> StrAsciiExt for &'a str {
401401
#[inline]
402402
fn to_ascii_upper(&self) -> String {
403-
unsafe { str_copy_map_bytes(*self, ASCII_UPPER_MAP) }
403+
unsafe { str_copy_map_bytes(*self, &ASCII_UPPER_MAP) }
404404
}
405405

406406
#[inline]
407407
fn to_ascii_lower(&self) -> String {
408-
unsafe { str_copy_map_bytes(*self, ASCII_LOWER_MAP) }
408+
unsafe { str_copy_map_bytes(*self, &ASCII_LOWER_MAP) }
409409
}
410410

411411
#[inline]
@@ -422,17 +422,17 @@ impl<'a> StrAsciiExt for &'a str {
422422
impl OwnedStrAsciiExt for String {
423423
#[inline]
424424
fn into_ascii_upper(self) -> String {
425-
unsafe { str_map_bytes(self, ASCII_UPPER_MAP) }
425+
unsafe { str_map_bytes(self, &ASCII_UPPER_MAP) }
426426
}
427427

428428
#[inline]
429429
fn into_ascii_lower(self) -> String {
430-
unsafe { str_map_bytes(self, ASCII_LOWER_MAP) }
430+
unsafe { str_map_bytes(self, &ASCII_LOWER_MAP) }
431431
}
432432
}
433433

434434
#[inline]
435-
unsafe fn str_map_bytes(string: String, map: &'static [u8]) -> String {
435+
unsafe fn str_map_bytes(string: String, map: &[u8, ..256]) -> String {
436436
let mut bytes = string.into_bytes();
437437

438438
for b in bytes.mut_iter() {
@@ -443,15 +443,15 @@ unsafe fn str_map_bytes(string: String, map: &'static [u8]) -> String {
443443
}
444444

445445
#[inline]
446-
unsafe fn str_copy_map_bytes(string: &str, map: &'static [u8]) -> String {
446+
unsafe fn str_copy_map_bytes(string: &str, map: &[u8, ..256]) -> String {
447447
let mut s = String::from_str(string);
448448
for b in s.as_mut_bytes().mut_iter() {
449449
*b = map[*b as uint];
450450
}
451451
s.into_string()
452452
}
453453

454-
static ASCII_LOWER_MAP: &'static [u8] = &[
454+
pub static ASCII_LOWER_MAP: [u8, ..256] = [
455455
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
456456
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
457457
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
@@ -490,7 +490,7 @@ static ASCII_LOWER_MAP: &'static [u8] = &[
490490
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
491491
];
492492

493-
static ASCII_UPPER_MAP: &'static [u8] = &[
493+
pub static ASCII_UPPER_MAP: [u8, ..256] = [
494494
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
495495
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
496496
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,

0 commit comments

Comments
 (0)