Struct ra_ap_hir_ty::TyBuilder

source ·
pub struct TyBuilder<D> { /* private fields */ }
Expand description

This is a builder for Ty or anything that needs a Substitution.

Implementations§

source§

impl<D> TyBuilder<D>

source

pub fn build_into_subst(self) -> Substitution

source

pub fn push(self, arg: impl CastTo<GenericArg>) -> Self

source

pub fn remaining(&self) -> usize

source

pub fn fill_with_bound_vars( self, debruijn: DebruijnIndex, starting_from: usize ) -> Self

source

pub fn fill_with_unknown(self) -> Self

source

pub fn fill(self, filler: impl FnMut(&ParamKind) -> GenericArg) -> Self

source§

impl TyBuilder<()>

source

pub fn unit() -> Ty

source

pub fn discr_ty() -> Ty

source

pub fn bool() -> Ty

source

pub fn usize() -> Ty

source

pub fn fn_ptr(sig: CallableSig) -> Ty

source

pub fn builtin(builtin: BuiltinType) -> Ty

source

pub fn slice(argument: Ty) -> Ty

source

pub fn placeholder_subst( db: &dyn HirDatabase, def: impl Into<GenericDefId> ) -> Substitution

source

pub fn unknown_subst( db: &dyn HirDatabase, def: impl Into<GenericDefId> ) -> Substitution

source

pub fn subst_for_def( db: &dyn HirDatabase, def: impl Into<GenericDefId>, parent_subst: Option<Substitution> ) -> TyBuilder<()>

source

pub fn subst_for_coroutine( db: &dyn HirDatabase, parent: DefWithBodyId ) -> TyBuilder<()>

Creates a TyBuilder to build Substitution for a coroutine defined in parent.

A coroutine’s substitution consists of:

  • resume type of coroutine
  • yield type of coroutine (Coroutine::Yield)
  • return type of coroutine (Coroutine::Return)
  • generic parameters in scope on parent in this order.

This method prepopulates the builder with placeholder substitution of parent, so you should only push exactly 3 GenericArgs before building.

source

pub fn subst_for_closure( db: &dyn HirDatabase, parent: DefWithBodyId, sig_ty: Ty ) -> Substitution

source

pub fn build(self) -> Substitution

source§

impl TyBuilder<AdtId>

source

pub fn adt(db: &dyn HirDatabase, def: AdtId) -> TyBuilder<AdtId>

source

pub fn fill_with_defaults( self, db: &dyn HirDatabase, fallback: impl FnMut() -> Ty ) -> Self

source

pub fn build(self) -> Ty

source§

impl TyBuilder<Tuple>

source

pub fn tuple(size: usize) -> TyBuilder<Tuple>

source

pub fn build(self) -> Ty

source

pub fn tuple_with<I>(elements: I) -> Ty

source§

impl TyBuilder<TraitId>

source

pub fn trait_ref(db: &dyn HirDatabase, def: TraitId) -> TyBuilder<TraitId>

source

pub fn build(self) -> TraitRef

source§

impl TyBuilder<TypeAliasId>

source§

impl<T: HasInterner<Interner = Interner> + TypeFoldable<Interner>> TyBuilder<Binders<T>>

source

pub fn build(self) -> T

source§

impl TyBuilder<Binders<Ty>>

source

pub fn def_ty( db: &dyn HirDatabase, def: TyDefId, parent_subst: Option<Substitution> ) -> TyBuilder<Binders<Ty>>

source

pub fn impl_self_ty(db: &dyn HirDatabase, def: ImplId) -> TyBuilder<Binders<Ty>>

Auto Trait Implementations§

§

impl<D> Freeze for TyBuilder<D>
where D: Freeze,

§

impl<D> RefUnwindSafe for TyBuilder<D>
where D: RefUnwindSafe,

§

impl<D> Send for TyBuilder<D>
where D: Send,

§

impl<D> Sync for TyBuilder<D>
where D: Sync,

§

impl<D> Unpin for TyBuilder<D>
where D: Unpin,

§

impl<D> UnwindSafe for TyBuilder<D>
where D: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Cast for T

source§

fn cast<U>(self, interner: <U as HasInterner>::Interner) -> U
where Self: CastTo<U>, U: HasInterner,

Cast a value to type U using CastTo.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoBox<dyn Any> for T
where T: Any,

source§

fn into_box(self) -> Box<dyn Any>

Convert self into the appropriate boxed form.
source§

impl<T> IntoBox<dyn Any + Send> for T
where T: Any + Send,

source§

fn into_box(self) -> Box<dyn Any + Send>

Convert self into the appropriate boxed form.
source§

impl<T> IntoBox<dyn Any + Sync + Send> for T
where T: Any + Send + Sync,

source§

fn into_box(self) -> Box<dyn Any + Sync + Send>

Convert self into the appropriate boxed form.
source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<'a, T> Captures<'a> for T
where T: ?Sized,