Remove doc::ItemType::class method
We only query the item class for two variants. It is easier to hardcode this two classes instead of providing all available classes.
This commit is contained in:
parent
473b091fca
commit
ebc9c58838
31
src/doc.rs
31
src/doc.rs
@ -243,37 +243,6 @@ impl ItemType {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn class(&self) -> &str {
|
||||
match self {
|
||||
ItemType::Module => "module",
|
||||
ItemType::ExternCrate => "extern-crate",
|
||||
ItemType::Import => "import",
|
||||
ItemType::Struct => "struct",
|
||||
ItemType::Enum => "enum",
|
||||
ItemType::Function => "function",
|
||||
ItemType::Typedef => "type",
|
||||
ItemType::Static => "static",
|
||||
ItemType::Trait => "trait",
|
||||
ItemType::Impl => "impl",
|
||||
ItemType::TyMethod => "required-method",
|
||||
ItemType::Method => "method",
|
||||
ItemType::StructField => "structfield",
|
||||
ItemType::Variant => "variant",
|
||||
ItemType::Macro => "macro",
|
||||
ItemType::Primitive => "primitive",
|
||||
ItemType::AssocType => "associated-type",
|
||||
ItemType::Constant => "constant",
|
||||
ItemType::AssocConst => "associated-const",
|
||||
ItemType::Union => "union",
|
||||
ItemType::ForeignType => "foreign-type",
|
||||
ItemType::Keyword => "keyword",
|
||||
ItemType::OpaqueTy => "opaque-type",
|
||||
ItemType::ProcAttribute => "proc-attribute",
|
||||
ItemType::ProcDerive => "proc-derive",
|
||||
ItemType::TraitAlias => "trait-alias",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn group_name(&self) -> &str {
|
||||
match self {
|
||||
ItemType::Module => "Modules",
|
||||
|
@ -275,7 +275,7 @@ fn get_fields(
|
||||
let mut definition: Option<doc::Text> = None;
|
||||
|
||||
while let Some(element) = &next {
|
||||
if element.is_element(&local_name!("span")) && element.has_class(ty.class()) {
|
||||
if element.is_element(&local_name!("span")) && element.has_class("structfield") {
|
||||
fields.push(&mut name, &mut definition, None)?;
|
||||
name = get_id_part(element, 1);
|
||||
definition = Some(element.into());
|
||||
@ -476,7 +476,7 @@ fn get_variants(
|
||||
let mut definition: Option<doc::Text> = None;
|
||||
while let Some(element) = &next {
|
||||
if element.is_element(&local_name!("div")) {
|
||||
if element.has_class(ty.class()) {
|
||||
if element.has_class("variant") {
|
||||
variants.push(&mut name, &mut definition, None)?;
|
||||
name = get_id_part(element, 1);
|
||||
definition = Some(element.into());
|
||||
|
Loading…
Reference in New Issue
Block a user