mirror of
https://github.com/servo/servo.git
synced 2025-06-14 03:14:29 +00:00
Remove EnumEntry, as Rust already provides O(1) access to the string length.
This commit is contained in:
parent
3e0d4a2509
commit
9a909229e3
2 changed files with 7 additions and 19 deletions
|
@ -2909,17 +2909,16 @@ class CGEnum(CGThing):
|
|||
def __init__(self, enum):
|
||||
CGThing.__init__(self)
|
||||
inner = """
|
||||
use dom::bindings::utils::EnumEntry;
|
||||
#[repr(uint)]
|
||||
pub enum valuelist {
|
||||
%s
|
||||
}
|
||||
|
||||
pub static strings: &'static [EnumEntry] = &[
|
||||
pub static strings: &'static [&'static str] = &[
|
||||
%s,
|
||||
];
|
||||
""" % (",\n ".join(map(getEnumValueName, enum.values())),
|
||||
",\n ".join(['EnumEntry {value: &"' + val + '", length: ' + str(len(val)) + '}' for val in enum.values()]))
|
||||
",\n ".join(['&"%s"' % val for val in enum.values()]))
|
||||
|
||||
self.cgRoot = CGList([
|
||||
CGNamespace.build([enum.identifier.name + "Values"],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue