Struct TypeState

Source
pub struct TypeState {
Show 13 fields pub(crate) type_vars: Vec<TypeVar>, pub(crate) key: u64, pub(crate) keys: BTreeSet<u64>, pub(crate) equations: TypeEquations, pub(crate) next_typeid: RefCell<u64>, pub(crate) generic_lists: HashMap<GenericListToken, HashMap<NameID, TypeVarID>>, pub(crate) constraints: TypeConstraints, pub(crate) requirements: Vec<Requirement>, pub(crate) replacements: ReplacementStack, pub(crate) pipeline_state: Option<PipelineState>, pub trait_impls: TraitImplList, pub trace_stack: TraceStack, pub diags: DiagList,
}
Expand description

State of the type inference algorithm

Fields§

§type_vars: Vec<TypeVar>

All types are referred to by their index to allow type vars changing inside the type state while the types are “out in the wild”. The TypeVarID is an index into this type_vars list which is used to look up the actual type as currently seen by the type state

§key: u64

This key is used to prevent bugs when multiple type states are mixed. Each TypeVarID holds the value of the key of the type state which created it, and this is checked to ensure that type vars are not mixed. The key is initialized randomly on type state creation

§keys: BTreeSet<u64>

A type state can also support keys from other sources, this is tracked here

§equations: TypeEquations§next_typeid: RefCell<u64>§generic_lists: HashMap<GenericListToken, HashMap<NameID, TypeVarID>>§constraints: TypeConstraints§requirements: Vec<Requirement>

Requirements which must be fulfilled but which do not guide further type inference. For example, if seeing let y = x.a before knowing the type of x, a requirement is added to say “x has field a, and y should be the type of that field”

§replacements: ReplacementStack§pipeline_state: Option<PipelineState>

The type var containing the depth of the pipeline stage we are currently in

§trait_impls: TraitImplList§trace_stack: TraceStack§diags: DiagList

Implementations§

Source§

impl TypeState

Source

pub fn visit_identifier( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, ) -> Result<()>

Source

pub fn visit_type_level_integer( &mut self, expression: &Loc<Expression>, generic_list: &GenericListToken, ctx: &Context<'_>, ) -> Result<()>

Source

pub fn visit_pipeline_ref( &mut self, expression: &Loc<Expression>, generic_list: &GenericListToken, ctx: &Context<'_>, ) -> Result<()>

Source

pub fn visit_int_literal( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, ) -> Result<()>

Source

pub fn visit_bool_literal( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, ) -> Result<()>

Source

pub fn visit_bit_literal( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, ) -> Result<()>

Source

pub fn visit_tuple_literal( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn visit_tuple_index( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn visit_field_access( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn visit_method_call( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn visit_array_literal( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn visit_array_shorthand_literal( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn visit_create_ports( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, _generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn visit_index( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn visit_range_index( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn visit_block_expr( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn visit_if( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn visit_match( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn visit_binary_operator( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn visit_unary_operator( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source§

impl TypeState

Source

pub fn t_int(&mut self, loc: Loc<()>, symtab: &SymbolTable) -> TypeVarID

Source

pub fn t_uint(&mut self, loc: Loc<()>, symtab: &SymbolTable) -> TypeVarID

Source

pub fn t_bit(&mut self, loc: Loc<()>, symtab: &SymbolTable) -> TypeVarID

Source

pub fn t_bool(&mut self, loc: Loc<()>, symtab: &SymbolTable) -> TypeVarID

Source

pub fn t_clock(&mut self, loc: Loc<()>, symtab: &SymbolTable) -> TypeVarID

Source

pub fn t_err(&mut self, loc: Loc<()>) -> TypeVarID

Source§

impl TypeState

Source

pub fn type_decl_to_concrete( decl: &TypeDeclaration, type_list: &TypeList, params: Vec<ConcreteType>, invert: bool, ) -> ConcreteType

Source

pub fn type_expr_to_concrete( expr: &TypeExpression, type_list: &TypeList, generic_substitutions: &HashMap<NameID, &ConcreteType>, invert: bool, ) -> ConcreteType

Source

pub fn type_spec_to_concrete( spec: &TypeSpec, type_list: &TypeList, generic_substitutions: &HashMap<NameID, &ConcreteType>, invert: bool, ) -> ConcreteType

Source

pub fn inner_ungenerify_type( &self, var: &TypeVarID, symtab: &SymbolTable, type_list: &TypeList, invert: bool, ) -> Option<ConcreteType>

Source

pub fn ungenerify_type( &self, var: &TypeVarID, symtab: &SymbolTable, type_list: &TypeList, ) -> Option<ConcreteType>

Converts the specified type to a concrete type, returning None if it fails

Source

pub fn concrete_type_of_infallible( &self, id: ExprID, symtab: &SymbolTable, type_list: &TypeList, ) -> ConcreteType

Returns the type of the specified expression ID as a concrete type. If the type is not known, or the type is Generic, panics

Source

pub fn concrete_type_of( &self, id: impl HasConcreteType, symtab: &SymbolTable, types: &TypeList, ) -> Result<ConcreteType, Diagnostic>

Returns the concrete type of anything that might have a concrete type. Errors if the type is not fully known.

Source

pub fn concrete_type_of_name( &self, name: &Loc<NameID>, symtab: &SymbolTable, types: &TypeList, ) -> Result<ConcreteType, Diagnostic>

Like concrete_type_of but reports an error message that mentions names instead of an expression

Source§

impl TypeState

Source

pub fn fresh() -> Self

Create a fresh type state, in most cases, this should be .create_child of an existing type state

Source

pub fn create_child(&self) -> Self

Source

pub fn add_type_var(&mut self, var: TypeVar) -> TypeVarID

Source

pub fn get_equations(&self) -> &TypeEquations

Source

pub fn get_constraints(&self) -> &TypeConstraints

Source

pub fn get_generic_list<'a>( &'a self, generic_list_token: &'a GenericListToken, ) -> Option<&'a HashMap<NameID, TypeVarID>>

Source

pub(crate) fn hir_type_expr_to_var<'a>( &'a mut self, e: &Loc<TypeExpression>, generic_list_token: &GenericListToken, ) -> Result<TypeVarID>

Source

pub fn type_var_from_hir<'a>( &'a mut self, loc: Loc<()>, hir_type: &TypeSpec, generic_list_token: &GenericListToken, ) -> Result<TypeVarID>

Source

pub fn type_of(&self, expr: &TypedExpression) -> TypeVarID

Returns the type of the expression with the specified id. Error if no equation for the specified expression exists

Source

pub fn maybe_type_of(&self, expr: &TypedExpression) -> Option<&TypeVarID>

Source

pub fn new_generic_int(&mut self, loc: Loc<()>, symtab: &SymbolTable) -> TypeVar

Source

pub fn new_concrete_int(&mut self, size: BigUint, loc: Loc<()>) -> TypeVarID

Source

pub fn new_split_generic_int( &mut self, loc: Loc<()>, symtab: &SymbolTable, ) -> (TypeVarID, TypeVarID)

Return a new generic int. The first returned value is int, and the second value is N

Source

pub fn new_split_generic_uint( &mut self, loc: Loc<()>, symtab: &SymbolTable, ) -> (TypeVarID, TypeVarID)

Source

pub fn new_generic_with_meta( &mut self, loc: Loc<()>, meta: MetaType, ) -> TypeVarID

Source

pub fn new_generic_type(&mut self, loc: Loc<()>) -> TypeVarID

Source

pub fn new_generic_any(&mut self) -> TypeVarID

Source

pub fn new_generic_tlbool(&mut self, loc: Loc<()>) -> TypeVarID

Source

pub fn new_generic_tluint(&mut self, loc: Loc<()>) -> TypeVarID

Source

pub fn new_generic_tlint(&mut self, loc: Loc<()>) -> TypeVarID

Source

pub fn new_generic_tlnumber(&mut self, loc: Loc<()>) -> TypeVarID

Source

pub fn new_generic_number( &mut self, loc: Loc<()>, ctx: &Context<'_>, ) -> (TypeVarID, TypeVarID)

Source

pub fn new_generic_with_traits( &mut self, loc: Loc<()>, traits: TraitList, ) -> TypeVarID

Source

pub fn get_pipeline_state<T>( &self, access_loc: &Loc<T>, ) -> Result<&PipelineState>

Returns the current pipeline state. access_loc is not used to specify where to get the state from, it is only used for the Diagnostic::bug that gets emitted if there is no pipeline state

Source

pub fn visit_unit_with_preprocessing( &mut self, entity: &Loc<Unit>, pp: impl Fn(&mut TypeState, &Loc<Unit>, &GenericListToken, &Context<'_>) -> Result<()>, ctx: &Context<'_>, ) -> Result<()>

Visit a unit but before doing any preprocessing run the pp function.

Source

pub fn visit_unit( &mut self, entity: &Loc<Unit>, ctx: &Context<'_>, ) -> Result<()>

Source

pub(crate) fn visit_argument_list( &mut self, args: &Loc<ArgumentList<Expression>>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub(crate) fn type_check_argument_list( &mut self, args: &[Argument<'_, Expression, TypeSpec>], ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn visit_expression_result( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, new_type: TypeVarID, ) -> Result<()>

Source

pub fn visit_expression( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, )

Source

pub(crate) fn handle_function_like( &mut self, expression_id: Loc<ExprID>, expression_type: &TypeVarID, name: &FunctionLikeName, head: &Loc<UnitHead>, call_kind: &CallKind, args: &Loc<ArgumentList<Expression>>, ctx: &Context<'_>, visit_args: bool, is_method: bool, turbofish: Option<TurbofishCtx<'_>>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn handle_concat( &mut self, expression_id: Loc<ExprID>, source_lhs_ty: TypeVarID, source_rhs_ty: TypeVarID, source_result_ty: TypeVarID, args: &[Argument<'_, Expression, TypeSpec>], ctx: &Context<'_>, ) -> Result<()>

Source

pub fn handle_trunc( &mut self, expression_id: Loc<ExprID>, source_in_ty: TypeVarID, source_result_ty: TypeVarID, args: &[Argument<'_, Expression, TypeSpec>], ctx: &Context<'_>, ) -> Result<()>

Source

pub fn handle_comb_mod_or_div( &mut self, n_ty: TypeVarID, args: &[Argument<'_, Expression, TypeSpec>], ctx: &Context<'_>, ) -> Result<()>

Source

pub fn handle_clocked_memory( &mut self, num_elements: TypeVarID, addr_size_arg: TypeVarID, args: &[Argument<'_, Expression, TypeSpec>], ctx: &Context<'_>, ) -> Result<()>

Source

pub fn handle_read_memory( &mut self, num_elements: TypeVarID, addr_size_arg: TypeVarID, args: &[Argument<'_, Expression, TypeSpec>], ctx: &Context<'_>, ) -> Result<()>

Source

pub fn create_generic_list( &mut self, source: GenericListSource<'_>, type_params: &[Loc<TypeParam>], scope_type_params: &[Loc<TypeParam>], turbofish: Option<TurbofishCtx<'_>>, where_clauses: &[Loc<WhereClause>], ) -> Result<GenericListToken>

Source

pub fn add_mapped_generic_list( &mut self, source: GenericListSource<'_>, mapping: HashMap<NameID, TypeVarID>, ) -> GenericListToken

Adds a generic list with parameters already mapped to types

Source

pub fn remove_generic_list(&mut self, source: GenericListSource<'_>)

Source

pub fn visit_block( &mut self, block: &Block, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn visit_impl_blocks(&mut self, item_list: &ItemList) -> TraitImplList

Source

pub fn visit_pattern( &mut self, pattern: &Loc<Pattern>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn visit_wal_trace( &mut self, trace: &Loc<WalTrace>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn visit_statement_error( &mut self, stmt: &Loc<Statement>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn visit_statement( &mut self, stmt: &Loc<Statement>, ctx: &Context<'_>, generic_list: &GenericListToken, )

Source

pub fn visit_register( &mut self, reg: &Register, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>

Source

pub fn visit_trait_spec( &mut self, trait_spec: &Loc<TraitSpec>, generic_list: &GenericListToken, ) -> Result<Loc<TraitReq>>

Source

pub fn visit_trait_bounds( &mut self, target: &Loc<NameID>, traits: &[Loc<TraitSpec>], generic_list_tok: &GenericListToken, ) -> Result<()>

Source

pub fn visit_const_generic_with_id( &mut self, gen: &Loc<ConstGenericWithId>, generic_list_token: &GenericListToken, constraint_source: ConstraintSource, ctx: &Context<'_>, ) -> Result<TypeVarID>

Source

pub fn visit_const_generic( &self, constraint: &ConstGeneric, generic_list: &GenericListToken, ) -> Result<ConstraintExpr>

Source§

impl TypeState

Source

pub(crate) fn new_typeid(&self) -> u64

Source

pub fn add_equation(&mut self, expression: TypedExpression, var: TypeVarID)

Source

pub(crate) fn add_constraint( &mut self, lhs: TypeVarID, rhs: ConstraintExpr, loc: Loc<()>, inside: &TypeVarID, source: ConstraintSource, )

Source

pub(crate) fn add_requirement(&mut self, requirement: Requirement)

Source

pub(crate) fn unify_inner( &mut self, e1: &impl HasType, e2: &impl HasType, ctx: &Context<'_>, ) -> Result<TypeVarID, UnificationError>

Performs unification but does not update constraints. This is done to avoid updating constraints more often than necessary. Technically, constraints can be updated even less often, but unify is a pretty natural point to do so.

Source

pub fn can_unify( &mut self, e1: &impl HasType, e2: &impl HasType, ctx: &Context<'_>, ) -> bool

Source

pub fn unify( &mut self, e1: &impl HasType, e2: &impl HasType, ctx: &Context<'_>, ) -> Result<TypeVarID, UnificationError>

Source

pub(crate) fn check_type_for_recursion( &self, ty: TypeVarID, seen: &mut Vec<TypeVarID>, ) -> Result<(), String>

Source

pub(crate) fn ensure_impls( &mut self, var: &TypeVarID, traits: &TraitList, trait_is_expected: bool, trait_list_loc: &Loc<()>, ctx: &Context<'_>, ) -> Result<Vec<(TraitImpl, TraitReq)>, UnificationError>

Source

pub fn unify_expression_generic_error( &mut self, expr: &Loc<Expression>, other: &impl HasType, ctx: &Context<'_>, ) -> Result<TypeVarID>

Source

pub fn check_requirements( &mut self, is_final_check: bool, ctx: &Context<'_>, ) -> Result<()>

Source

pub fn get_replacement(&self, var: &TypeVarID) -> TypeVarID

Source

pub fn do_and_restore<T, E>( &mut self, inner: impl Fn(&mut Self) -> Result<T, E>, ) -> Result<T, E>

Source

pub(crate) fn checkpoint(&mut self)

Create a “checkpoint” to which we can restore later using restore. This acts like a stack, nested checkpoints are possible

Source

pub(crate) fn restore(&mut self)

Source§

impl TypeState

Source

pub fn print_equations(&self)

Trait Implementations§

Source§

impl Clone for TypeState

Source§

fn clone(&self) -> TypeState

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'de> Deserialize<'de> for TypeState

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for TypeState

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

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

impl<T> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
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> 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> Pipe for T
where T: ?Sized,

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
Source§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
Source§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
Source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

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

Source§

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>,

Source§

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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,