pub struct TranslatedCrate {Show 14 fields
pub crate_name: String,
pub real_crate_name: String,
pub id_to_file: Vector<FileId, FileName>,
pub file_to_id: HashMap<FileName, FileId>,
pub file_id_to_content: HashMap<FileId, String>,
pub all_ids: LinkedHashSet<AnyTransId>,
pub item_names: HashMap<AnyTransId, Name>,
pub type_decls: Vector<TypeDeclId, TypeDecl>,
pub fun_decls: Vector<FunDeclId, FunDecl>,
pub global_decls: Vector<GlobalDeclId, GlobalDecl>,
pub bodies: Vector<BodyId, Body>,
pub trait_decls: Vector<TraitDeclId, TraitDecl>,
pub trait_impls: Vector<TraitImplId, TraitImpl>,
pub ordered_decls: Option<DeclarationsGroups>,
}
Expand description
The data of a translated crate.
Fields§
§crate_name: String
The name that the user requested for the crate. This may differ from what rustc reports as the name of the crate.
real_crate_name: String
The name of the crate according to rustc.
id_to_file: Vector<FileId, FileName>
File names to ids and vice-versa
file_to_id: HashMap<FileName, FileId>
§file_id_to_content: HashMap<FileId, String>
File id to content.
Note that some files may be missing, if they are not “real” files.
all_ids: LinkedHashSet<AnyTransId>
All the ids, in the order in which we encountered them
item_names: HashMap<AnyTransId, Name>
The names of all registered items. Available so we can know the names even of items that failed to translate.
type_decls: Vector<TypeDeclId, TypeDecl>
The translated type definitions
fun_decls: Vector<FunDeclId, FunDecl>
The translated function definitions
global_decls: Vector<GlobalDeclId, GlobalDecl>
The translated global definitions
bodies: Vector<BodyId, Body>
The bodies of functions and constants
trait_decls: Vector<TraitDeclId, TraitDecl>
The translated trait declarations
trait_impls: Vector<TraitImplId, TraitImpl>
The translated trait declarations
ordered_decls: Option<DeclarationsGroups>
The re-ordered groups of declarations, initialized as empty.
Implementations§
source§impl TranslatedCrate
impl TranslatedCrate
pub fn get_item( &self, trans_id: impl Into<AnyTransId>, ) -> Option<AnyTransItem<'_>>
pub fn item_name(&self, trans_id: impl Into<AnyTransId>) -> Option<&Name>
pub fn all_items(&self) -> impl Iterator<Item = AnyTransItem<'_>>
pub fn all_items_with_ids( &self, ) -> impl Iterator<Item = (AnyTransId, AnyTransItem<'_>)>
Trait Implementations§
source§impl Clone for TranslatedCrate
impl Clone for TranslatedCrate
source§fn clone(&self) -> TranslatedCrate
fn clone(&self) -> TranslatedCrate
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Default for TranslatedCrate
impl Default for TranslatedCrate
source§fn default() -> TranslatedCrate
fn default() -> TranslatedCrate
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for TranslatedCrate
impl<'de> Deserialize<'de> for TranslatedCrate
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for TranslatedCrate
impl Display for TranslatedCrate
source§impl DriveMut for TranslatedCrate
impl DriveMut for TranslatedCrate
source§impl Index<BodyId> for TranslatedCrate
impl Index<BodyId> for TranslatedCrate
source§impl Index<FunDeclId> for TranslatedCrate
impl Index<FunDeclId> for TranslatedCrate
source§impl Index<GlobalDeclId> for TranslatedCrate
impl Index<GlobalDeclId> for TranslatedCrate
source§type Output = GlobalDecl
type Output = GlobalDecl
The returned type after indexing.
source§impl Index<TraitDeclId> for TranslatedCrate
impl Index<TraitDeclId> for TranslatedCrate
source§impl Index<TraitImplId> for TranslatedCrate
impl Index<TraitImplId> for TranslatedCrate
source§impl Index<TypeDeclId> for TranslatedCrate
impl Index<TypeDeclId> for TranslatedCrate
source§impl IndexMut<BodyId> for TranslatedCrate
impl IndexMut<BodyId> for TranslatedCrate
source§impl IndexMut<FunDeclId> for TranslatedCrate
impl IndexMut<FunDeclId> for TranslatedCrate
source§impl IndexMut<GlobalDeclId> for TranslatedCrate
impl IndexMut<GlobalDeclId> for TranslatedCrate
source§impl IndexMut<TraitDeclId> for TranslatedCrate
impl IndexMut<TraitDeclId> for TranslatedCrate
source§impl IndexMut<TraitImplId> for TranslatedCrate
impl IndexMut<TraitImplId> for TranslatedCrate
source§impl IndexMut<TypeDeclId> for TranslatedCrate
impl IndexMut<TypeDeclId> for TranslatedCrate
source§impl<'tcx, 'ctx, 'a> IntoFormatter for &'a TranslatedCrate
impl<'tcx, 'ctx, 'a> IntoFormatter for &'a TranslatedCrate
Auto Trait Implementations§
impl Freeze for TranslatedCrate
impl RefUnwindSafe for TranslatedCrate
impl Send for TranslatedCrate
impl Sync for TranslatedCrate
impl Unpin for TranslatedCrate
impl UnwindSafe for TranslatedCrate
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
Given the context attached to a nom error, and given the original
input to the nom parser, extract more the useful context information. Read more
§impl<T> Indentable for Twhere
T: Display,
impl<T> Indentable for Twhere
T: Display,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<I> RecreateContext<I> for I
impl<I> RecreateContext<I> for I
§fn recreate_context(_original_input: I, tail: I) -> I
fn recreate_context(_original_input: I, tail: I) -> I
Given the original input, as well as the context reported by nom,
recreate a context in the original string where the error occurred. Read more