pub struct FamousDefs<'a, 'b>(pub &'a Semantics<'b, RootDatabase>, pub Crate);
Expand description
Helps with finding well-know things inside the standard library. This is somewhat similar to the known paths infra inside hir, but it different; We want to make sure that IDE specific paths don’t become interesting inside the compiler itself as well.
Note that, by default, rust-analyzer tests do not include core or std
libraries. If you are writing tests for functionality using FamousDefs
,
you’d want to include minicore (see test_utils::MiniCore
) declaration at
the start of your tests:
//- minicore: iterator, ord, derive
Tuple Fields§
§0: &'a Semantics<'b, RootDatabase>
§1: Crate
Implementations§
source§impl FamousDefs<'_, '_>
impl FamousDefs<'_, '_>
pub fn std(&self) -> Option<Crate>
pub fn core(&self) -> Option<Crate>
pub fn alloc(&self) -> Option<Crate>
pub fn test(&self) -> Option<Crate>
pub fn proc_macro(&self) -> Option<Crate>
pub fn core_cmp_Ord(&self) -> Option<Trait>
pub fn core_convert_From(&self) -> Option<Trait>
pub fn core_convert_Into(&self) -> Option<Trait>
pub fn core_convert_Index(&self) -> Option<Trait>
pub fn core_option_Option(&self) -> Option<Enum>
pub fn core_result_Result(&self) -> Option<Enum>
pub fn core_default_Default(&self) -> Option<Trait>
pub fn core_iter_Iterator(&self) -> Option<Trait>
pub fn core_iter_IntoIterator(&self) -> Option<Trait>
pub fn core_iter(&self) -> Option<Module>
pub fn core_ops_Deref(&self) -> Option<Trait>
pub fn core_ops_DerefMut(&self) -> Option<Trait>
pub fn core_convert_AsRef(&self) -> Option<Trait>
pub fn core_ops_ControlFlow(&self) -> Option<Enum>
pub fn core_ops_Drop(&self) -> Option<Trait>
pub fn core_marker_Copy(&self) -> Option<Trait>
pub fn core_future_Future(&self) -> Option<Trait>
pub fn core_macros_builtin_derive(&self) -> Option<Macro>
pub fn core_mem_drop(&self) -> Option<Function>
pub fn core_macros_todo(&self) -> Option<Macro>
pub fn core_macros_unimplemented(&self) -> Option<Macro>
pub fn builtin_crates(&self) -> impl Iterator<Item = Crate>
Auto Trait Implementations§
impl<'a, 'b> Freeze for FamousDefs<'a, 'b>
impl<'a, 'b> !RefUnwindSafe for FamousDefs<'a, 'b>
impl<'a, 'b> !Send for FamousDefs<'a, 'b>
impl<'a, 'b> !Sync for FamousDefs<'a, 'b>
impl<'a, 'b> Unpin for FamousDefs<'a, 'b>
impl<'a, 'b> !UnwindSafe for FamousDefs<'a, 'b>
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
§impl<T> Cast for T
impl<T> Cast for T
§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