Skip to content

char can't be used as integral type anymore #3

Description

@dobkeratops

info from wiki
<mark_edward> there was a recent PR merged, that meant that chars could no longer be used as integral types
<mark_edward> lemme find it...
<doomlord__> oh does that break ioutil.rs by any chance :)
<mark_edward> it breaks.. this: https://github.com/dobkeratops/rustfind/blob/master/htmlwriter.rs#L81
<doomlord__> ok, yikes.
<mark_edward> also something seems to have changed about .unwrap_or_default
<doomlord__> i vaguely remermber talk about that but can't remember what changed..
<doomlord__> it might just be renamed to .unwrap_or() ?
<doomlord__> i seem to remember some discussion about wanting symetry between or's /elses
<mark_edward> right, right, lemme check
<doomlord__> hopefully the char thing is just something changing to u8s perhaps..
<mark_edward> hopefully... maybe there is still a way to get chars to ints, lol
<doomlord__> in the name of safety it's sometimes surprising what you cant do ... but in that instance i think i'm ultimately just transfrering charcters from one buffer to another.. ither might even be a more direct function
<mark_edward> doomlord__: do you think this will do it: http://seld.be/rustdoc/master/std/char/fn.to_digit.html
<doomlord__> ah - i had to translate soemthing ,
<doomlord__> oh yeah now i remember - its translating various things for html .. "<" -> "<" etc etc
<doomlord__> so its not a straight copy
<mark_edward> hmmm...
<doomlord__> perhaps that could be a key:value map if they really dont want chars indexable.
<doomlord__> ^or if they really dont want to use chars as ints (indices)
<doomlord__> self.doc.push_str(self.xlat[x]); <<<< sorry for the crytpic ASM inspired name, ".xlat" is a translation table holding all that.
<doomlord__> so xlat:[str] could be changed to xlat:hashmap<char,str>
<mark_edward> you think that approach won't break too much else? and do hashmaps have [x] indexing?
<doomlord__> it would be changed to "self.doc.push_str(self.xlat.find(x).unwrap_or(""))" i think
<doomlord__> similarly building xlat would be .insert(...)
<mark_edward> okay..
<doomlord__> https://github.com/dobkeratops/rustfind/blob/master/htmlwriter.rs <<< mk_xlat_table

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions