1
Fork 0

Rename render::Type to improve naming

This commit is contained in:
Guillaume Gomez 2020-03-03 15:53:16 +01:00
parent 5654cde729
commit d964e60e4f
2 changed files with 8 additions and 8 deletions

View file

@ -302,14 +302,14 @@ impl Serialize for IndexItem {
/// A type used for the search index. /// A type used for the search index.
#[derive(Debug)] #[derive(Debug)]
struct Type { struct RenderType {
ty: Option<DefId>, ty: Option<DefId>,
idx: Option<usize>, idx: Option<usize>,
name: Option<String>, name: Option<String>,
generics: Option<Vec<Generic>>, generics: Option<Vec<Generic>>,
} }
impl Serialize for Type { impl Serialize for RenderType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where where
S: Serializer, S: Serializer,
@ -388,12 +388,12 @@ impl Serialize for IndexItemFunctionType {
#[derive(Debug)] #[derive(Debug)]
pub struct TypeWithKind { pub struct TypeWithKind {
ty: Type, ty: RenderType,
kind: TypeKind, kind: TypeKind,
} }
impl From<(Type, TypeKind)> for TypeWithKind { impl From<(RenderType, TypeKind)> for TypeWithKind {
fn from(x: (Type, TypeKind)) -> TypeWithKind { fn from(x: (RenderType, TypeKind)) -> TypeWithKind {
TypeWithKind { ty: x.0, kind: x.1 } TypeWithKind { ty: x.0, kind: x.1 }
} }
} }

View file

@ -12,7 +12,7 @@ use std::path::{Path, PathBuf};
use serde::Serialize; use serde::Serialize;
use super::{plain_summary_line, shorten, Impl, IndexItem, IndexItemFunctionType, ItemType}; use super::{plain_summary_line, shorten, Impl, IndexItem, IndexItemFunctionType, ItemType};
use super::{Generic, RenderInfo, Type, TypeWithKind}; use super::{Generic, RenderInfo, RenderType, TypeWithKind};
/// Indicates where an external crate can be found. /// Indicates where an external crate can be found.
pub enum ExternalLocation { pub enum ExternalLocation {
@ -665,8 +665,8 @@ fn get_index_search_type(item: &clean::Item) -> Option<IndexItemFunctionType> {
Some(IndexItemFunctionType { inputs, output }) Some(IndexItemFunctionType { inputs, output })
} }
fn get_index_type(clean_type: &clean::Type) -> Type { fn get_index_type(clean_type: &clean::Type) -> RenderType {
let t = Type { let t = RenderType {
ty: clean_type.def_id(), ty: clean_type.def_id(),
idx: None, idx: None,
name: get_index_type_name(clean_type, true).map(|s| s.to_ascii_lowercase()), name: get_index_type_name(clean_type, true).map(|s| s.to_ascii_lowercase()),