pub struct ApiDependencyGraph<'tcx> {
graph: Graph<DepNode<'tcx>, DepEdge>,
node_indices: HashMap<DepNode<'tcx>, NodeIndex>,
ty_nodes: Vec<NodeIndex>,
api_nodes: Vec<NodeIndex>,
all_apis: HashSet<DefId>,
tcx: TyCtxt<'tcx>,
}
Fields§
§graph: Graph<DepNode<'tcx>, DepEdge>
§node_indices: HashMap<DepNode<'tcx>, NodeIndex>
§ty_nodes: Vec<NodeIndex>
§api_nodes: Vec<NodeIndex>
§all_apis: HashSet<DefId>
§tcx: TyCtxt<'tcx>
Implementations§
Source§impl<'tcx> ApiDependencyGraph<'tcx>
impl<'tcx> ApiDependencyGraph<'tcx>
pub fn eligible_nodes_with(&self, tys: &[Ty<'tcx>]) -> Vec<DepNode<'tcx>>
pub fn eligible_transforms_to( &self, ty: Ty<'tcx>, ) -> Vec<(TyWrapper<'tcx>, TransformKind)>
Source§impl<'tcx> ApiDependencyGraph<'tcx>
impl<'tcx> ApiDependencyGraph<'tcx>
pub fn resolve_generic_api(&mut self)
pub fn search_reachable_apis(&mut self) -> HashMap<DefId, HashSet<Mono<'tcx>>>
pub fn prune_by_similarity( &mut self, generic_map: HashMap<DefId, HashSet<Mono<'tcx>>>, )
fn recache(&mut self)
pub fn propagate_reserved( &self, node: NodeIndex, visited: &mut [bool], reserved: &mut [bool], ) -> bool
Source§impl<'tcx> ApiDependencyGraph<'tcx>
impl<'tcx> ApiDependencyGraph<'tcx>
Source§impl<'tcx> ApiDependencyGraph<'tcx>
impl<'tcx> ApiDependencyGraph<'tcx>
pub fn update_transform_edges(&mut self)
fn add_possible_transform<const MAX_DEPTH: usize>( &mut self, current_ty: TyWrapper<'tcx>, depth: usize, ) -> Option<NodeIndex>
Source§impl<'tcx> ApiDependencyGraph<'tcx>
impl<'tcx> ApiDependencyGraph<'tcx>
pub fn new(tcx: TyCtxt<'tcx>) -> ApiDependencyGraph<'tcx>
pub fn num_api(&self) -> usize
pub fn num_ty(&self) -> usize
pub fn api_at(&self, idx: usize) -> (DefId, GenericArgsRef<'tcx>)
fn tcx(&self) -> TyCtxt<'tcx>
pub fn build(&mut self, config: Config)
pub fn inner_graph(&self) -> &Graph<DepNode<'tcx>, DepEdge>
pub fn statistics(&self) -> Statistics
pub fn is_node_exist(&self, node: &DepNode<'tcx>) -> bool
pub fn get_or_create_index(&mut self, node: DepNode<'tcx>) -> NodeIndex
pub fn get_index(&self, node: DepNode<'tcx>) -> Option<NodeIndex>
pub fn add_edge(&mut self, src: NodeIndex, dst: NodeIndex, edge: DepEdge)
pub fn add_edge_once(&mut self, src: NodeIndex, dst: NodeIndex, edge: DepEdge)
pub fn add_generic_api(&mut self, fn_did: DefId) -> bool
Sourcepub fn add_api(&mut self, fn_did: DefId, args: &[GenericArg<'tcx>]) -> bool
pub fn add_api(&mut self, fn_did: DefId, args: &[GenericArg<'tcx>]) -> bool
return true if the api is added successfully, false if it already exists.
Sourcepub fn all_transforms(&self, ty: Ty<'tcx>) -> Vec<TransformKind>
pub fn all_transforms(&self, ty: Ty<'tcx>) -> Vec<TransformKind>
return all transform kind for ty
that we intersted in.
pub fn is_start_node_index(&self, index: NodeIndex) -> bool
pub fn estimate_coverage_with( &self, tcx: TyCtxt<'tcx>, f_cover: &mut impl FnMut(DefId), f_total: &mut impl FnMut(DefId), )
Sourcepub fn estimate_coverage(&mut self) -> (usize, usize)
pub fn estimate_coverage(&mut self) -> (usize, usize)
estimate_coverage
treat each API as the distinct API.
For example, if foo<T>
, foo<U>
are covered, this API return (2, 2).
Sourcepub fn estimate_coverage_distinct(&mut self) -> (usize, usize)
pub fn estimate_coverage_distinct(&mut self) -> (usize, usize)
estimate_coverage_distinct
treat mono API as the original generic API.
For example, if foo<T>
, foo<U>
are covered, this API return (1, 1).
pub fn dump_to_dot<P: AsRef<Path>>(&self, path: P, tcx: TyCtxt<'tcx>)
Trait Implementations§
Source§impl<'tcx> Clone for ApiDependencyGraph<'tcx>
impl<'tcx> Clone for ApiDependencyGraph<'tcx>
Source§fn clone(&self) -> ApiDependencyGraph<'tcx>
fn clone(&self) -> ApiDependencyGraph<'tcx>
Returns a duplicate 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 moreAuto Trait Implementations§
impl<'tcx> Freeze for ApiDependencyGraph<'tcx>
impl<'tcx> !RefUnwindSafe for ApiDependencyGraph<'tcx>
impl<'tcx> !Send for ApiDependencyGraph<'tcx>
impl<'tcx> !Sync for ApiDependencyGraph<'tcx>
impl<'tcx> Unpin for ApiDependencyGraph<'tcx>
impl<'tcx> !UnwindSafe for ApiDependencyGraph<'tcx>
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