Term

Enum Term 

Source
#[non_exhaustive]
pub enum Term {
Show 19 variants RuntimeType(TypeBound), StaticType, BoundedNatType(UpperBound), StringType, BytesType, FloatType, ListType(Box<Term>), TupleType(Box<Term>), Runtime(TypeBase<NoRV>), BoundedNat(u64), String(String), Bytes(Arc<[u8]>), Float(OrderedFloat<f64>), List(Vec<Term>), ListConcat(Vec<Term>), Tuple(Vec<Term>), TupleConcat(Vec<Term>), Variable(TermVar), ConstType(Box<TypeBase<NoRV>>),
}
Expand description

A term in the language of static parameters in HUGR.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

RuntimeType(TypeBound)

The type of runtime types.

§

StaticType

The type of static data.

§

BoundedNatType(UpperBound)

The type of static natural numbers up to a given bound.

§

StringType

The type of static strings. See Term::String.

§

BytesType

The type of static byte strings. See Term::Bytes.

§

FloatType

The type of static floating point numbers. See Term::Float.

§

ListType(Box<Term>)

The type of static lists of indeterminate size containing terms of the specified static type.

§

TupleType(Box<Term>)

The type of static tuples.

§

Runtime(TypeBase<NoRV>)

A runtime type as a term. Instance of Term::RuntimeType.

§

BoundedNat(u64)

A 64bit unsigned integer literal. Instance of Term::BoundedNatType.

§

String(String)

UTF-8 encoded string literal. Instance of Term::StringType.

§

Bytes(Arc<[u8]>)

Byte string literal. Instance of Term::BytesType.

§

Float(OrderedFloat<f64>)

A 64-bit floating point number. Instance of Term::FloatType.

§

List(Vec<Term>)

A list of static terms. Instance of Term::ListType.

§

ListConcat(Vec<Term>)

Instance of TypeParam::List defined by a sequence of concatenated lists of the same type.

§

Tuple(Vec<Term>)

Instance of TypeParam::Tuple defined by a sequence of elements of varying type.

§

TupleConcat(Vec<Term>)

Instance of TypeParam::Tuple defined by a sequence of concatenated tuples.

§

Variable(TermVar)

Variable (used in type schemes or inside polymorphic functions), but not a runtime type (not even a row variable i.e. list of runtime types)

§

ConstType(Box<TypeBase<NoRV>>)

The type of constants for a runtime type.

A constant is a compile time description of how to produce a runtime value. The runtime value is constructed when the constant is loaded.

Constants are distinct from the runtime values that they describe. In particular, as part of the term language, constants can be freely copied or destroyed even when they describe a non-linear runtime value.

Implementations§

Source§

impl Term

Source

pub const fn max_nat_type() -> Term

Creates a Term::BoundedNatType with the maximum bound (u64::MAX + 1).

Source

pub const fn bounded_nat_type(upper_bound: NonZero<u64>) -> Term

Creates a Term::BoundedNatType with the stated upper bound (non-exclusive).

Source

pub fn new_list(items: impl IntoIterator<Item = Term>) -> Term

Creates a new Term::List given a sequence of its items.

Source

pub fn new_list_type(elem: impl Into<Term>) -> Term

Creates a new Term::ListType given the type of its elements.

Source

pub fn new_tuple_type(item_types: impl Into<Term>) -> Term

Creates a new Term::TupleType given the type of its elements.

Source

pub fn new_const(ty: impl Into<TypeBase<NoRV>>) -> Term

Creates a new Term::ConstType from a runtime type.

Source§

impl Term

Source

pub const UNIT: Term

Source

pub fn new_var_use(idx: usize, decl: Term) -> Term

Makes a TypeArg representing a use (occurrence) of the type variable with the specified index. decl must be exactly that with which the variable was declared.

Source

pub fn new_string(str: impl ToString) -> Term

Creates a new string literal.

Source

pub fn new_list_concat(lists: impl IntoIterator<Item = Term>) -> Term

Creates a new concatenated list.

Source

pub fn new_tuple(items: impl IntoIterator<Item = Term>) -> Term

Creates a new tuple from its items.

Source

pub fn new_tuple_concat(tuples: impl IntoIterator<Item = Term>) -> Term

Creates a new concatenated tuple.

Source

pub fn as_nat(&self) -> Option<u64>

Returns an integer if the Term is a natural number literal.

Source

pub fn as_runtime(&self) -> Option<TypeBase<NoRV>>

Returns a Type if the Term is a runtime type.

Source

pub fn as_string(&self) -> Option<String>

Returns a string if the Term is a string literal.

Source

pub fn new_list_from_parts( parts: impl IntoIterator<Item = SeqPart<Term>>, ) -> Term

Creates a new list from a sequence of SeqParts.

Source

pub fn into_list_parts(self) -> ListPartIter

Iterates over the SeqParts of a list.

§Examples

The parts of a closed list are the items of that list wrapped in SeqPart::Item:

let term = Term::new_list([a.clone(), b.clone()]);

assert_eq!(
    term.into_list_parts().collect::<Vec<_>>(),
    vec![SeqPart::Item(a), SeqPart::Item(b)]
);

Parts of a concatenated list that are not closed lists are wrapped in SeqPart::Splice:

let var = Term::new_var_use(0, Term::new_list_type(Term::StringType));
let term = Term::new_list_concat([
    Term::new_list([a.clone(), b.clone()]),
    var.clone(),
    Term::new_list([c.clone()])
 ]);

assert_eq!(
    term.into_list_parts().collect::<Vec<_>>(),
    vec![SeqPart::Item(a), SeqPart::Item(b), SeqPart::Splice(var), SeqPart::Item(c)]
);

Nested concatenations are traversed recursively:

let term = Term::new_list_concat([
    Term::new_list_concat([
        Term::new_list([a.clone()]),
        Term::new_list([b.clone()])
    ]),
    Term::new_list([]),
    Term::new_list([c.clone()])
]);

assert_eq!(
    term.into_list_parts().collect::<Vec<_>>(),
    vec![SeqPart::Item(a), SeqPart::Item(b), SeqPart::Item(c)]
);

When invoked on a type argument that is not a list, a single SeqPart::Splice is returned that wraps the type argument. This is the expected behaviour for type variables that stand for lists. This behaviour also allows this method not to fail on ill-typed type arguments.

let term = Term::new_string("not a list");
assert_eq!(
    term.clone().into_list_parts().collect::<Vec<_>>(),
    vec![SeqPart::Splice(term)]
);
Source

pub fn new_tuple_from_parts( parts: impl IntoIterator<Item = SeqPart<Term>>, ) -> Term

Creates a new tuple from a sequence of SeqParts.

Analogous to TypeArg::new_list_from_parts.

Source

pub fn into_tuple_parts(self) -> TuplePartIter

Iterates over the SeqParts of a tuple.

Analogous to TypeArg::into_list_parts.

Trait Implementations§

Source§

impl Clone for Term

Source§

fn clone(&self) -> Term

Returns a duplicate 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 Debug for Term

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Term

Source§

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

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

impl Display for Term

Source§

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

Formats the value using the given formatter. Read more
Source§

impl From<&str> for Term

Source§

fn from(arg: &str) -> Term

Converts to this type from the input type.
Source§

impl<const N: usize> From<[Term; N]> for Term

Source§

fn from(value: [Term; N]) -> Term

Converts to this type from the input type.
Source§

impl From<ArrayOrTermSer> for Term

Source§

fn from(value: ArrayOrTermSer) -> Term

Converts to this type from the input type.
Source§

impl From<String> for Term

Source§

fn from(arg: String) -> Term

Converts to this type from the input type.
Source§

impl From<TermSer> for Term

Source§

fn from(value: TermSer) -> Term

Converts to this type from the input type.
Source§

impl<RV> From<TypeBase<RV>> for Term
where RV: MaybeRV,

Source§

fn from(value: TypeBase<RV>) -> Term

Converts to this type from the input type.
Source§

impl From<TypeBound> for Term

Source§

fn from(bound: TypeBound) -> Term

Converts to this type from the input type.
Source§

impl From<TypeRowBase<NoRV>> for Term

Source§

fn from(value: TypeRowBase<NoRV>) -> Term

Converts to this type from the input type.
Source§

impl From<TypeRowBase<RowVariable>> for Term

Source§

fn from(value: TypeRowBase<RowVariable>) -> Term

Converts to this type from the input type.
Source§

impl From<UpperBound> for Term

Source§

fn from(bound: UpperBound) -> Term

Converts to this type from the input type.
Source§

impl From<Vec<Term>> for Term

Source§

fn from(elems: Vec<Term>) -> Term

Converts to this type from the input type.
Source§

impl From<u64> for Term

Source§

fn from(n: u64) -> Term

Converts to this type from the input type.
Source§

impl Hash for Term

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Term

Source§

fn eq(&self, other: &Term) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Term

Source§

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

Serialize this value into the given Serde serializer. Read more
Source§

impl Transformable for Term

Source§

fn transform<T>(&mut self, tr: &T) -> Result<bool, <T as TypeTransformer>::Err>
where T: TypeTransformer,

Applies a TypeTransformer to this instance. Read more
Source§

impl TryFrom<Term> for TypeBase<RowVariable>

Source§

type Error = SignatureError

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

fn try_from( value: Term, ) -> Result<TypeBase<RowVariable>, <TypeBase<RowVariable> as TryFrom<Term>>::Error>

Performs the conversion.
Source§

impl TryFrom<Term> for TypeRowBase<NoRV>

Source§

type Error = SignatureError

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

fn try_from( value: Term, ) -> Result<TypeRowBase<NoRV>, <TypeRowBase<NoRV> as TryFrom<Term>>::Error>

Performs the conversion.
Source§

impl TryFrom<Term> for TypeRowBase<RowVariable>

Source§

type Error = SignatureError

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

fn try_from( value: Term, ) -> Result<TypeRowBase<RowVariable>, <TypeRowBase<RowVariable> as TryFrom<Term>>::Error>

Performs the conversion.
Source§

impl Eq for Term

Source§

impl StructuralPartialEq for Term

Auto Trait Implementations§

§

impl Freeze for Term

§

impl !RefUnwindSafe for Term

§

impl Send for Term

§

impl Sync for Term

§

impl Unpin for Term

§

impl !UnwindSafe for Term

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> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

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

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
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> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

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> ToSmolStr for T
where T: Display + ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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> TryHash for T
where T: Hash,

Source§

fn try_hash(&self, st: &mut dyn Hasher) -> bool

Hashes the value, if possible; else return false without mutating the Hasher. This relates with CustomConst::equal_consts just like Hash with Eq: Read more
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
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,