pub struct ApiDependencyGraph<'tcx> {
graph: Graph<DepNode<'tcx>, DepEdge>,
node_indices: HashMap<DepNode<'tcx>, NodeIndex>,
ty_nodes: Vec<NodeIndex>,
api_nodes: Vec<NodeIndex>,
tcx: TyCtxt<'tcx>,
}Fields§
§graph: Graph<DepNode<'tcx>, DepEdge>§node_indices: HashMap<DepNode<'tcx>, NodeIndex>§ty_nodes: Vec<NodeIndex>§api_nodes: Vec<NodeIndex>§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>
Source§impl<'tcx> ApiDependencyGraph<'tcx>
impl<'tcx> ApiDependencyGraph<'tcx>
pub fn dump_to_dot(&self) -> String
Source§impl<'tcx> ApiDependencyGraph<'tcx>
impl<'tcx> ApiDependencyGraph<'tcx>
pub fn resolve_generic_api( &mut self, non_generic_apis: &[DefId], generic_apis: &[DefId], max_iteration: usize, )
pub fn search_reachable_apis( &mut self, non_generic_apis: &[DefId], generic_apis: &[DefId], max_iteration: usize, ) -> HashMap<DefId, HashSet<Mono<'tcx>>>
pub fn add_mono_apis_from_map( &mut self, generic_map: &HashMap<DefId, HashSet<Mono<'tcx>>>, )
Sourcepub fn heuristic_select(&mut self, reserved: &mut [bool])
pub fn heuristic_select(&mut self, reserved: &mut [bool])
heuristic strategy: prioritize to reserve APIs that first arg of which is reachable. This is based on that we want to reserve APIs that have the same Self type ASAP.
pub fn minimal_select( &mut self, reserved: &mut [bool], generic_map: &HashMap<DefId, HashSet<Mono<'tcx>>>, )
pub fn prune_by_similarity( &mut self, generic_map: HashMap<DefId, HashSet<Mono<'tcx>>>, ) -> Vec<bool>
pub fn reserve_nodes(&mut self, reserved: &[bool]) -> usize
pub fn propagate_reserved( &self, node: NodeIndex, visited: &mut [bool], reserved: &mut [bool], ) -> bool
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_node_at(&self, idx: usize) -> DepNode<'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_node_from_index(&self, index: NodeIndex) -> DepNode<'tcx>
pub fn get_index_by_ty(&self, ty: Ty<'tcx>) -> Option<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_identity_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 depth_map(&self) -> HashMap<DepNode<'tcx>, usize>
pub fn traverse_covered_api_with( &self, f_cover: &mut impl FnMut(DefId), f_total: &mut impl FnMut(DefId), )
fn recache(&mut self)
pub fn uncovered_api(&self) -> Vec<DefId>
Sourcepub fn estimate_coverage(&self) -> (usize, usize)
pub fn estimate_coverage(&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(&self) -> (usize, usize)
pub fn estimate_coverage_distinct(&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_apis<P: AsRef<Path>>(&self, path: P)
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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