Skip to main content

ReplaceTypes

Struct ReplaceTypes 

Source
pub struct ReplaceTypes { /* private fields */ }
๐Ÿ‘ŽDeprecated since 0.26.2:

hugr-passes is deprecated. Use tket::passes instead

Expand description

A lowering ComposablePass that replaces types, ops and constants, i.e. changing node signatures/interfaces.

The struct configures what types, ops, and constants should be replaced with what, and may be applied to a Hugr via Self::run.

Parametrized types and ops will be reparameterized taking into account the replacements, but any ops taking/returning the replaced types not as a result of parametrization, will also need to be replaced - see Self::replace_op. Similarly Consts.

Types that are Copyable may also be replaced with types that are not, see Linearizer.

Note that although this pass may be used before monomorphization, there are some limitations (that do not apply if done after monomorphization):

  • NodeTemplate::CompoundOp only works for operations that do not use type variables
  • โ€œOverridesโ€ of specific instantiations of polymorphic types will not be detected if the instantiations are created inside polymorphic functions. For example, suppose we Self::replace_type type A with X, Self::replace_parametrized_type container MyList with List, and Self::replace_type MyList<A> with SpecialListOfXs. If a function foo polymorphic over a type variable T dealing with MyList<T>s, that is called with type argument A, then foo<T> will be updated to deal with List<T>s and the call foo<A> updated to foo<X>, but this will still result in using List<X> rather than SpecialListOfXs. (However this would be fine after monomorphization: the monomorphic definition of foo_A would use SpecialListOfXs.)
  • See also limitations noted for Linearizer.

Implementationsยง

Sourceยง

impl ReplaceTypes

Source

pub fn new_empty() -> Self

๐Ÿ‘ŽDeprecated since 0.26.2:

hugr-passes is deprecated. Use tket::passes instead

Makes a new instance. Unlike Self::default, this does not understand any extension types, even those in the prelude.

Source

pub fn replace_type(&mut self, src: CustomType, dest: Type)

๐Ÿ‘ŽDeprecated since 0.25.0:

Use set_replace_type

Configures this instance to replace occurrences of type src with dest.

Source

pub fn set_replace_type(&mut self, src: CustomType, dest: Type)

๐Ÿ‘ŽDeprecated since 0.26.2:

hugr-passes is deprecated. Use tket::passes instead

Configures this instance to replace occurrences of type src with dest.

dest will be recursively transformed by this ReplaceTypes before replacement. (Cases where a type should be replaced by a type containing an instance of the first type, must be handled by two separate ReplaceTypesโ€™s via a temporary type. )

Note that if src is an instance of a parametrized TypeDef, this takes precedence over Self::replace_parametrized_type where the srcs overlap. Thus, this should only be used on already-monomorphized Hugrs, as substitution (parametric polymorphism) happening later will not respect this replacement.

If there are any LoadConstants of this type, callers should also call Self::replace_consts (or Self::replace_consts_parametrized) as the LoadConstants will be reparameterized (and this will break the edge from Const to LoadConstant).

Note that if src is Copyable and dest is Linear, then (besides linearity violations) SignatureError will be raised if this leads to an impossible type e.g. ArrayOfCopyables(src). (This can be overridden by an additional Self::replace_type.)

Source

pub fn replace_type_opts( &mut self, src: CustomType, dest: Type, opts: ReplacementOptions, )

๐Ÿ‘ŽDeprecated since 0.25.0:

Use set_replace_type

Configures this instance to replace occurrences of type src with dest, according to the given ReplacementOptions.

Source

pub fn replace_parametrized_type( &mut self, src: &TypeDef, dest_fn: impl Fn(&[TypeArg]) -> Option<Type> + 'static, )

๐Ÿ‘ŽDeprecated since 0.25.0:

Use set_replace_parametrized_type

Configures this instance to change occurrences of a parametrized type src via a callback that builds the replacement type given the TypeArgs.

Source

pub fn set_replace_parametrized_type( &mut self, src: &TypeDef, dest_fn: impl Fn(&[TypeArg]) -> Option<Type> + 'static, )

๐Ÿ‘ŽDeprecated since 0.26.2:

hugr-passes is deprecated. Use tket::passes instead

Configures this instance to change occurrences of a parametrized type src via a callback that builds the replacement type given the TypeArgs.

Note that the TypeArgs will already have been updated (e.g. they may not fit the bounds of the original type). The callback may return None to indicate no change (in which case the supplied TypeArgs will be given to src). The returned type will also be subject to recursive processing by this ReplaceTypes. (Cases where a type should be replaced by a type containing an instance of the first type, must be handled by two separate ReplaceTypesโ€™s via a temporary type. )

If there are any LoadConstants of any of these types, callers should also call Self::replace_consts_parametrized (or Self::replace_consts) as the LoadConstants will be reparameterized (and this will break the edge from Const to LoadConstant). See Self::set_replace_type for more details (including recursion).

Source

pub fn replace_parametrized_type_opts( &mut self, src: &TypeDef, dest_fn: impl Fn(&[TypeArg]) -> Option<Type> + 'static, opts: ReplacementOptions, )

๐Ÿ‘ŽDeprecated since 0.25.0:

Use set_replace_parametrized_type

Configures this instance to change occurrences of a parametrized type src via a callback that builds the replacement type given the TypeArgs, and using the given ReplacementOptions.

Source

pub fn linearizer(&mut self) -> &mut DelegatingLinearizer

๐Ÿ‘ŽDeprecated since 0.25.0:

Use get_linearizer or linearizer_mut

Allows to configure how to deal with types/wires that were Copyable but have become linear as a result of type-changing.

Source

pub fn linearizer_mut(&mut self) -> &mut DelegatingLinearizer

๐Ÿ‘ŽDeprecated since 0.26.2:

hugr-passes is deprecated. Use tket::passes instead

Allows to configure how to deal with types/wires that were Copyable but have become linear as a result of type-changing. Specifically, the Linearizer is used whenever lowering produces an outport which both

  • has a non-Copyable type - perhaps a direct substitution, or perhaps e.g. as a result of changing the element type of a collection such as an array
  • has other than one connected inport,
Source

pub fn get_linearizer(&self) -> &impl Linearizer

๐Ÿ‘ŽDeprecated since 0.26.2:

hugr-passes is deprecated. Use tket::passes instead

Allows use of the linearizer (e.g. in a callback passed to Self::set_replace_parametrized_op)

Source

pub fn replace_op(&mut self, src: &ExtensionOp, dest: NodeTemplate)

๐Ÿ‘ŽDeprecated since 0.25.0:

Use set_replace_op

Configures this instance to change occurrences of src to dest.

Source

pub fn set_replace_op(&mut self, src: &ExtensionOp, dest: NodeTemplate)

๐Ÿ‘ŽDeprecated since 0.26.2:

hugr-passes is deprecated. Use tket::passes instead

Configures this instance to change occurrences of src to dest.

The RHS will be recursively processed by this ReplaceTypes. (Cases where an op should be replaced by a container including an instance of the same op, must be handled by two separate ReplaceTypesโ€™s via a temporary op.)

Note that if src is an instance of a parametrized OpDef, this takes precedence over Self::set_replace_parametrized_op where the srcs overlap. Thus, this method should only be used for already-monomorphized Hugrs, as substitution (parametric polymorphism) happening later will not respect this replacement.

Source

pub fn replace_op_with( &mut self, src: &ExtensionOp, dest: NodeTemplate, opts: ReplacementOptions, )

๐Ÿ‘ŽDeprecated since 0.25.0:

Use set_replace_op

Configures this instance to change occurrences of src to dest.

Source

pub fn replace_parametrized_op( &mut self, src: &OpDef, dest_fn: impl Fn(&[TypeArg]) -> Option<NodeTemplate> + 'static, )

๐Ÿ‘ŽDeprecated since 0.25.0:

Use set_replace_parametrized_op

Configures this instance to change occurrences of a parametrized op src via a callback that builds the replacement type given the TypeArgs.

Source

pub fn set_replace_parametrized_op( &mut self, src: &OpDef, dest_fn: impl Fn(&[TypeArg], &ReplaceTypes) -> Result<Option<NodeTemplate>, ReplaceTypesError> + 'static, )

๐Ÿ‘ŽDeprecated since 0.26.2:

hugr-passes is deprecated. Use tket::passes instead

Configures this instance to change occurrences of a parametrized op src via a callback that builds the replacement type given the TypeArgs. Note that the TypeArgs will already have been updated (e.g. they may not fit the bounds of the original op); and the returned NodeTemplate will be recursively processed by this ReplaceTypes. (Cases where an op should be replaced by a container including an instance of the same op, must be handled by two separate ReplaceTypesโ€™s via a temporary op.)

If the Callback returns None, the new typeargs will be applied to the original op.

Source

pub fn replace_parametrized_op_with( &mut self, src: &OpDef, dest_fn: impl Fn(&[TypeArg]) -> Option<NodeTemplate> + 'static, opts: ReplacementOptions, )

๐Ÿ‘ŽDeprecated since 0.25.0:

Use set_replace_parametrized_op

Configures this instance to change occurrences of a parametrized op src via a callback that builds the replacement type given the TypeArgs.

Source

pub fn replace_consts( &mut self, src_ty: CustomType, const_fn: impl Fn(&OpaqueValue, &ReplaceTypes) -> Result<Value, ReplaceTypesError> + 'static, )

๐Ÿ‘ŽDeprecated since 0.26.2:

hugr-passes is deprecated. Use tket::passes instead

Configures this instance to change Consts of type src_ty, using a callback that is passed the value of the constant (of that type).

Note that if src_ty is an instance of a parametrized TypeDef, this takes precedence over Self::replace_consts_parametrized where the src_tys overlap.

Source

pub fn replace_consts_parametrized( &mut self, src_ty: &TypeDef, const_fn: impl Fn(&OpaqueValue, &ReplaceTypes) -> Result<Option<Value>, ReplaceTypesError> + 'static, )

๐Ÿ‘ŽDeprecated since 0.26.2:

hugr-passes is deprecated. Use tket::passes instead

Configures this instance to change Consts of all types that are instances of a parametrized typedef src_ty, using a callback that is passed the value of the constant (the OpaqueValue contains the TypeArgs). The callback may return None to indicate no change to the constant.

Source

pub fn set_regions(&mut self, regions: impl IntoIterator<Item = Node>)

๐Ÿ‘ŽDeprecated since 0.26.2:

hugr-passes is deprecated. Use tket::passes instead

Set the regions of the Hugr to which this pass should be applied.

If not set, the pass is applied to the whole Hugr. Each call overwrites any previous calls to set_regions and/or Self::with_scope.

Source

pub fn change_value(&self, value: &mut Value) -> Result<bool, ReplaceTypesError>

๐Ÿ‘ŽDeprecated since 0.26.2:

hugr-passes is deprecated. Use tket::passes instead

Modifies the specified Value in-place according to current configuration. Returns whether the value has changed (conservative over-approximation).

Trait Implementationsยง

Sourceยง

impl Clone for ReplaceTypes

Sourceยง

fn clone(&self) -> ReplaceTypes

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) ยท Sourceยง

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

Performs copy-assignment from source. Read more
Sourceยง

impl<H: HugrMut<Node = Node>> ComposablePass<H> for ReplaceTypes

Sourceยง

type Error = ReplaceTypesError

๐Ÿ‘ŽDeprecated since 0.26.2:

hugr-passes is deprecated. Use tket::passes instead

Error thrown by this pass.
Sourceยง

type Result = bool

๐Ÿ‘ŽDeprecated since 0.26.2:

hugr-passes is deprecated. Use tket::passes instead

Result returned by this pass.
Sourceยง

fn run(&self, hugr: &mut H) -> Result<bool, ReplaceTypesError>

๐Ÿ‘ŽDeprecated since 0.26.2:

hugr-passes is deprecated. Use tket::passes instead

Run the pass on the given HUGR.
Sourceยง

fn map_err<E2: Error>( self, f: impl Fn(Self::Error) -> E2, ) -> impl ComposablePass<H, Result = Self::Result, Error = E2>

๐Ÿ‘ŽDeprecated since 0.26.2:

hugr-passes is deprecated. Use tket::passes instead

Apply a function to the error type of this pass, returning a new ComposablePass that has the same result type.
Sourceยง

fn then<P: ComposablePass<H>, E: ErrorCombiner<Self::Error, P::Error>>( self, other: P, ) -> impl ComposablePass<H, Result = (Self::Result, P::Result), Error = E>

๐Ÿ‘ŽDeprecated since 0.26.2:

hugr-passes is deprecated. Use tket::passes instead

Returns a ComposablePass that does โ€œself then otherโ€, so long as other::Err can be combined with ours. Read more
Sourceยง

impl Default for ReplaceTypes

Sourceยง

fn default() -> Self

Returns the โ€œdefault valueโ€ for a type. Read more
Sourceยง

impl TypeTransformer for ReplaceTypes

Sourceยง

type Err = ReplaceTypesError

Error returned when a CustomType cannot be transformed, or a type containing it (e.g. if changing a runtime type from copyable to linear invalidates a parameterized type).
Sourceยง

fn apply_custom(&self, ct: &CustomType) -> Result<Option<Type>, Self::Err>

Applies the transformation to an extension type. Read more
Sourceยง

impl WithScope for ReplaceTypes

Sourceยง

fn with_scope(self, scope: impl Into<PassScope>) -> Self

๐Ÿ‘ŽDeprecated since 0.26.2:

hugr-passes is deprecated. Use tket::passes instead

Sets the scope within which the pass will operate. Note that this pass ignores

Hence, really only the PassScope::root affects the pass.

Sourceยง

fn default_with_scope(scope: PassScope) -> Self
where Self: Default,

๐Ÿ‘ŽDeprecated since 0.26.2:

hugr-passes is deprecated. Use tket::passes instead

Return a default instance of the pass with the given scope. 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> Convert<&Arc<T>> for T
where T: Clone,

Sourceยง

fn convert(source: &Arc<T>) -> T

Sourceยง

impl<T> Convert<&Rc<T>> for T
where T: Clone,

Sourceยง

fn convert(source: &Rc<T>) -> T

Sourceยง

impl<T> Convert<&T> for T
where T: Clone,

Sourceยง

fn convert(source: &T) -> T

Sourceยง

impl<T> Convert<T> for T

Sourceยง

fn convert(source: T) -> T

Sourceยง

impl<T> Downcast for T
where T: Any,

Sourceยง

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Sourceยง

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Sourceยง

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Anyโ€™s vtable from &Traitโ€™s.
Sourceยง

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Anyโ€™s vtable from &mut Traitโ€™s.
Sourceยง

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

Sourceยง

fn __clone_box(&self, _: Private) -> *mut ()

Sourceยง

impl<T> FmtForward for T

Sourceยง

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Sourceยง

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Sourceยง

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Sourceยง

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Sourceยง

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Sourceยง

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Sourceยง

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Sourceยง

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
Sourceยง

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. 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> Pointable for T

Sourceยง

const ALIGN: usize

The alignment of pointer.
Sourceยง

type Init = T

The type for initializers.
Sourceยง

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Sourceยง

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Sourceยง

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Sourceยง

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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<'a, S, T> View<'a, &S> for T
where T: View<'a, S>, S: Copy,

Sourceยง

fn view(module: &'a Module<'a>, id: &S) -> Option<T>

Attempt to interpret a subpart of a module as this type.
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