pub struct TranslatedCrate {
pub crate_name: String,
pub real_crate_name: String,
pub options: CliOpts,
pub all_ids: IndexSet<AnyTransId>,
pub item_names: HashMap<AnyTransId, Name>,
pub files: Vector<FileId, File>,
pub type_decls: Vector<TypeDeclId, TypeDecl>,
pub fun_decls: Vector<FunDeclId, FunDecl>,
pub global_decls: Vector<GlobalDeclId, GlobalDecl>,
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.
options: CliOpts
The options used when calling Charon. It is useful for the applications which consumed the serialized code, to check that Charon was called with the proper options.
all_ids: IndexSet<AnyTransId>
All the item 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.
Invariant: after translation, any existing AnyTransId
must have an associated name, even
if the corresponding item wasn’t translated.
files: Vector<FileId, File>
The translated files.
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
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 item_name(&self, trans_id: impl Into<AnyTransId>) -> Option<&Name>
pub fn get_item( &self, trans_id: impl Into<AnyTransId>, ) -> Option<AnyTransItem<'_>>
pub fn get_item_mut( &mut self, trans_id: AnyTransId, ) -> Option<AnyTransItemMut<'_>>
pub fn all_items(&self) -> impl Iterator<Item = AnyTransItem<'_>>
pub fn all_items_with_ids( &self, ) -> impl Iterator<Item = (AnyTransId, AnyTransItem<'_>)>
pub fn all_items_mut(&mut self) -> impl Iterator<Item = AnyTransItemMut<'_>>
Trait Implementations§
source§impl AstVisitable for TranslatedCrate
impl AstVisitable for TranslatedCrate
source§fn drive<V: VisitAst>(&self, v: &mut V) -> ControlFlow<V::Break>
fn drive<V: VisitAst>(&self, v: &mut V) -> ControlFlow<V::Break>
visit_$any
method if it exists, otherwise visit_inner
.source§fn drive_mut<V: VisitAstMut>(&mut self, v: &mut V) -> ControlFlow<V::Break>
fn drive_mut<V: VisitAstMut>(&mut self, v: &mut V) -> ControlFlow<V::Break>
visit_$any
method if it exists, otherwise visit_inner
.source§fn dyn_visit<T: AstVisitable>(&self, f: impl FnMut(&T))
fn dyn_visit<T: AstVisitable>(&self, f: impl FnMut(&T))
self
, in pre-order traversal.source§fn dyn_visit_mut<T: AstVisitable>(&mut self, f: impl FnMut(&mut T))
fn dyn_visit_mut<T: AstVisitable>(&mut self, f: impl FnMut(&mut T))
self
, in pre-order traversal.source§impl Clone for TranslatedCrate
impl Clone for TranslatedCrate
source§fn clone(&self) -> TranslatedCrate
fn clone(&self) -> TranslatedCrate
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Default for TranslatedCrate
impl Default for TranslatedCrate
source§fn default() -> TranslatedCrate
fn default() -> TranslatedCrate
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>,
source§impl Display for TranslatedCrate
impl Display for TranslatedCrate
source§impl<'s, V> Drive<'s, V> for TranslatedCratewhere
V: Visitor + Visit<'s, HashMap<AnyTransId, Name>> + Visit<'s, Vector<TypeDeclId, TypeDecl>> + Visit<'s, Vector<FunDeclId, FunDecl>> + Visit<'s, Vector<GlobalDeclId, GlobalDecl>> + Visit<'s, Vector<TraitDeclId, TraitDecl>> + Visit<'s, Vector<TraitImplId, TraitImpl>>,
impl<'s, V> Drive<'s, V> for TranslatedCratewhere
V: Visitor + Visit<'s, HashMap<AnyTransId, Name>> + Visit<'s, Vector<TypeDeclId, TypeDecl>> + Visit<'s, Vector<FunDeclId, FunDecl>> + Visit<'s, Vector<GlobalDeclId, GlobalDecl>> + Visit<'s, Vector<TraitDeclId, TraitDecl>> + Visit<'s, Vector<TraitImplId, TraitImpl>>,
source§fn drive_inner(&'s self, visitor: &mut V) -> ControlFlow<V::Break>
fn drive_inner(&'s self, visitor: &mut V) -> ControlFlow<V::Break>
v.visit()
on the immediate contents of self
.source§impl<'s, V> DriveMut<'s, V> for TranslatedCratewhere
V: Visitor + VisitMut<'s, HashMap<AnyTransId, Name>> + VisitMut<'s, Vector<TypeDeclId, TypeDecl>> + VisitMut<'s, Vector<FunDeclId, FunDecl>> + VisitMut<'s, Vector<GlobalDeclId, GlobalDecl>> + VisitMut<'s, Vector<TraitDeclId, TraitDecl>> + VisitMut<'s, Vector<TraitImplId, TraitImpl>>,
impl<'s, V> DriveMut<'s, V> for TranslatedCratewhere
V: Visitor + VisitMut<'s, HashMap<AnyTransId, Name>> + VisitMut<'s, Vector<TypeDeclId, TypeDecl>> + VisitMut<'s, Vector<FunDeclId, FunDecl>> + VisitMut<'s, Vector<GlobalDeclId, GlobalDecl>> + VisitMut<'s, Vector<TraitDeclId, TraitDecl>> + VisitMut<'s, Vector<TraitImplId, TraitImpl>>,
source§fn drive_inner_mut(&'s mut self, visitor: &mut V) -> ControlFlow<V::Break>
fn drive_inner_mut(&'s mut self, visitor: &mut V) -> ControlFlow<V::Break>
v.visit()
on the immediate contents of self
.source§impl HasVectorOf<FunDeclId> for TranslatedCrate
impl HasVectorOf<FunDeclId> for TranslatedCrate
source§impl HasVectorOf<GlobalDeclId> for TranslatedCrate
impl HasVectorOf<GlobalDeclId> for TranslatedCrate
fn get_vector(&self) -> &Vector<GlobalDeclId, Self::Output>
fn get_vector_mut(&mut self) -> &mut Vector<GlobalDeclId, Self::Output>
source§impl HasVectorOf<TraitDeclId> for TranslatedCrate
impl HasVectorOf<TraitDeclId> for TranslatedCrate
fn get_vector(&self) -> &Vector<TraitDeclId, Self::Output>
fn get_vector_mut(&mut self) -> &mut Vector<TraitDeclId, Self::Output>
source§impl HasVectorOf<TraitImplId> for TranslatedCrate
impl HasVectorOf<TraitImplId> for TranslatedCrate
fn get_vector(&self) -> &Vector<TraitImplId, Self::Output>
fn get_vector_mut(&mut self) -> &mut Vector<TraitImplId, Self::Output>
source§impl HasVectorOf<TypeDeclId> for TranslatedCrate
impl HasVectorOf<TypeDeclId> for TranslatedCrate
fn get_vector(&self) -> &Vector<TypeDeclId, Self::Output>
fn get_vector_mut(&mut self) -> &mut Vector<TypeDeclId, Self::Output>
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
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<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
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)
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)
§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>
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>
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
source§impl<T> TyVisitable for Twhere
T: AstVisitable,
impl<T> TyVisitable for Twhere
T: AstVisitable,
fn substitute(self, generics: &GenericArgs) -> Self
fn substitute_with_self( self, generics: &GenericArgs, self_ref: &TraitRefKind, ) -> Self
source§fn move_under_binder(self) -> Self
fn move_under_binder(self) -> Self
source§fn move_under_binders(self, depth: DeBruijnId) -> Self
fn move_under_binders(self, depth: DeBruijnId) -> Self
depth
binders.source§fn move_from_under_binders(self, depth: DeBruijnId) -> Option<Self>
fn move_from_under_binders(self, depth: DeBruijnId) -> Option<Self>
depth
binders. Returns None
if it contains a variable bound in
one of these depth
binders.source§fn visit_db_id<B>(
&mut self,
f: impl FnMut(&mut DeBruijnId) -> ControlFlow<B>,
) -> ControlFlow<B>
fn visit_db_id<B>( &mut self, f: impl FnMut(&mut DeBruijnId) -> ControlFlow<B>, ) -> ControlFlow<B>
self
, as seen from the outside of self
. This means
that any variable bound inside self
will be skipped, and all the seen indices will count
from the outside of self.