Struct chalk_solve::display::state::InternalWriterState

source ·
pub(super) struct InternalWriterState<'a, I: Interner> {
    persistent_state: WriterState<I, dyn RustIrDatabase<I> + 'a, &'a dyn RustIrDatabase<I>>,
    indent_level: usize,
    debrujin_indices_deep: u32,
    remapping: Rc<BTreeMap<InvertedBoundVar, InvertedBoundVar>>,
    self_mapping: Option<InvertedBoundVar>,
}
Expand description

Writer state for a single write call, persistent only as long as necessary to write a single item.

Stores things necessary for .

Fields§

§persistent_state: WriterState<I, dyn RustIrDatabase<I> + 'a, &'a dyn RustIrDatabase<I>>§indent_level: usize§debrujin_indices_deep: u32§remapping: Rc<BTreeMap<InvertedBoundVar, InvertedBoundVar>>§self_mapping: Option<InvertedBoundVar>

Implementations§

source§

impl<'a, I: Interner> InternalWriterState<'a, I>

source

pub fn new<DB, P>(persistent_state: &'a WriterState<I, DB, P>) -> Self
where DB: RustIrDatabase<I>, P: Borrow<DB>,

source

pub(super) fn db(&self) -> &dyn RustIrDatabase<I>

source

pub(super) fn add_indent(&self) -> Self

source

pub(super) fn indent(&self) -> impl Display

source

pub(super) fn alias_for_adt_id_name( &self, id: I::InternedAdtId, name: String, ) -> impl Display

source

pub(super) fn alias_for_id_name( &self, id: I::DefId, name: String, ) -> impl Display

source

pub(super) fn add_debrujin_index(&self, self_binding: Option<usize>) -> Self

Adds a level of debrujin index, and possibly a “Self” parameter.

This should be called whenever recursing into the value within a Binders.

If self_binding is Some, then it will introduce a new variable named Self with the within-debrujin index given within and the innermost debrujian index after increasing debrujin index.

source

pub(super) fn add_parameter_mapping( &self, lowered_vars: impl Iterator<Item = InvertedBoundVar>, original_vars: impl Iterator<Item = InvertedBoundVar>, ) -> Self

Adds parameter remapping.

Each of the parameters in lowered_vars will be mapped to its corresponding variable in original_vars when printed through the InternalWriterState returned from this method.

lowered_vars and original_vars must have the same length.

source

pub(super) fn invert_debrujin_idx( &self, debrujin_idx: u32, index: usize, ) -> InvertedBoundVar

Inverts the debrujin index so as to create a canonical name we can anywhere for each bound variable.

See InvertedBoundVar.

source

pub(super) fn apply_mappings(&self, b: InvertedBoundVar) -> impl Display

source

pub(super) fn indices_for_bound_var(&self, b: &BoundVar) -> InvertedBoundVar

source

pub(super) fn indices_for_introduced_bound_var( &self, idx: usize, ) -> InvertedBoundVar

source

pub(super) fn display_bound_var(&self, b: &BoundVar) -> impl Display

source

pub(super) fn name_for_introduced_bound_var(&self, idx: usize) -> impl Display

source

pub(super) fn binder_var_indices<'b>( &'b self, binders: &'b VariableKinds<I>, ) -> impl Iterator<Item = InvertedBoundVar> + 'b

source

pub(super) fn binder_var_display<'b>( &'b self, binders: &'b VariableKinds<I>, ) -> impl Iterator<Item = String> + 'b

Trait Implementations§

source§

impl<'a, I: Clone + Interner> Clone for InternalWriterState<'a, I>

source§

fn clone(&self) -> InternalWriterState<'a, I>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a, I: Debug + Interner> Debug for InternalWriterState<'a, I>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, I> Freeze for InternalWriterState<'a, I>

§

impl<'a, I> !RefUnwindSafe for InternalWriterState<'a, I>

§

impl<'a, I> !Send for InternalWriterState<'a, I>

§

impl<'a, I> !Sync for InternalWriterState<'a, I>

§

impl<'a, I> !Unpin for InternalWriterState<'a, I>

§

impl<'a, I> !UnwindSafe for InternalWriterState<'a, I>

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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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