@@ -293,13 +293,12 @@ def emit_bsearch_range_table(f):
293293 f .write ("""
294294fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
295295 use core::cmp::{Equal, Less, Greater};
296- use core::slice::ImmutableVector;
297- use core::option::None;
298- r.bsearch(|&(lo,hi)| {
296+ use core::slice::ImmutableSlice;
297+ r.binary_search(|&(lo,hi)| {
299298 if lo <= c && c <= hi { Equal }
300299 else if hi < c { Less }
301300 else { Greater }
302- }) != None
301+ }).found().is_some()
303302}\n
304303""" )
305304
@@ -352,9 +351,10 @@ def emit_conversions_module(f, lowerupper, upperlower):
352351 f .write ("pub mod conversions {" )
353352 f .write ("""
354353 use core::cmp::{Equal, Less, Greater};
355- use core::slice::ImmutableVector ;
354+ use core::slice::ImmutableSlice ;
356355 use core::tuple::Tuple2;
357356 use core::option::{Option, Some, None};
357+ use core::slice;
358358
359359 pub fn to_lower(c: char) -> char {
360360 match bsearch_case_table(c, LuLl_table) {
@@ -371,11 +371,14 @@ def emit_conversions_module(f, lowerupper, upperlower):
371371 }
372372
373373 fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option<uint> {
374- table.bsearch (|&(key, _)| {
374+ match table.binary_search (|&(key, _)| {
375375 if c == key { Equal }
376376 else if key < c { Less }
377377 else { Greater }
378- })
378+ }) {
379+ slice::Found(i) => Some(i),
380+ slice::NotFound(_) => None,
381+ }
379382 }
380383
381384""" )
@@ -387,8 +390,8 @@ def emit_conversions_module(f, lowerupper, upperlower):
387390
388391def emit_grapheme_module (f , grapheme_table , grapheme_cats ):
389392 f .write ("""pub mod grapheme {
390- use core::option::{Some, None} ;
391- use core::slice::ImmutableVector ;
393+ use core::slice::ImmutableSlice ;
394+ use core::slice;
392395
393396 #[allow(non_camel_case_types)]
394397 #[deriving(Clone)]
@@ -400,16 +403,16 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats):
400403
401404 fn bsearch_range_value_table(c: char, r: &'static [(char, char, GraphemeCat)]) -> GraphemeCat {
402405 use core::cmp::{Equal, Less, Greater};
403- match r.bsearch (|&(lo, hi, _)| {
406+ match r.binary_search (|&(lo, hi, _)| {
404407 if lo <= c && c <= hi { Equal }
405408 else if hi < c { Less }
406409 else { Greater }
407410 }) {
408- Some (idx) => {
411+ slice::Found (idx) => {
409412 let (_, _, cat) = r[idx];
410413 cat
411414 }
412- None => GC_Any
415+ slice::NotFound(_) => GC_Any
413416 }
414417 }
415418
@@ -427,20 +430,21 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats):
427430def emit_charwidth_module (f , width_table ):
428431 f .write ("pub mod charwidth {\n " )
429432 f .write (" use core::option::{Option, Some, None};\n " )
430- f .write (" use core::slice::ImmutableVector;\n " )
433+ f .write (" use core::slice::ImmutableSlice;\n " )
434+ f .write (" use core::slice;\n " )
431435 f .write ("""
432436 fn bsearch_range_value_table(c: char, is_cjk: bool, r: &'static [(char, char, u8, u8)]) -> u8 {
433437 use core::cmp::{Equal, Less, Greater};
434- match r.bsearch (|&(lo, hi, _, _)| {
438+ match r.binary_search (|&(lo, hi, _, _)| {
435439 if lo <= c && c <= hi { Equal }
436440 else if hi < c { Less }
437441 else { Greater }
438442 }) {
439- Some (idx) => {
443+ slice::Found (idx) => {
440444 let (_, _, r_ncjk, r_cjk) = r[idx];
441445 if is_cjk { r_cjk } else { r_ncjk }
442446 }
443- None => 1
447+ slice::NotFound(_) => 1
444448 }
445449 }
446450""" )
@@ -525,19 +529,19 @@ def comp_pfun(char):
525529
526530 f .write ("""
527531 fn bsearch_range_value_table(c: char, r: &'static [(char, char, u8)]) -> u8 {
528- use core::option::{Some, None};
529532 use core::cmp::{Equal, Less, Greater};
530- use core::slice::ImmutableVector;
531- match r.bsearch(|&(lo, hi, _)| {
533+ use core::slice::ImmutableSlice;
534+ use core::slice;
535+ match r.binary_search(|&(lo, hi, _)| {
532536 if lo <= c && c <= hi { Equal }
533537 else if hi < c { Less }
534538 else { Greater }
535539 }) {
536- Some (idx) => {
540+ slice::Found (idx) => {
537541 let (_, _, result) = r[idx];
538542 result
539543 }
540- None => 0
544+ slice::NotFound(_) => 0
541545 }
542546 }\n
543547""" )
0 commit comments