Skip to main content

Placeholder

Struct Placeholder 

Source
pub struct Placeholder;
Expand description

Placeholder Parameter type for Parameterized types that is used represent Parameterized::parameter_structure. That is, it is used to replace every nested parameter in a Parameterized type yielding a structure-only representation that can later be used with Parameterized::from_parameters to instantiate a Parameterized value with the same shape but different types of parameters.

Trait Implementations§

Source§

impl Clone for Placeholder

Source§

fn clone(&self) -> Placeholder

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 Placeholder

Source§

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

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

impl Display for Placeholder

Source§

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

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

impl Hash for Placeholder

Source§

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

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 Ord for Placeholder

Source§

fn cmp(&self, other: &Placeholder) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Placeholder

Source§

fn eq(&self, other: &Placeholder) -> 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 PartialOrd for Placeholder

Source§

fn partial_cmp(&self, other: &Placeholder) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for Placeholder

Source§

impl Eq for Placeholder

Source§

impl Parameter for Placeholder

Source§

impl StructuralPartialEq for Placeholder

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<P> Parameterized<P> for P
where P: Parameter,

Source§

type Family = ParameterParameterizedFamily

ParameterizedFamily that this type belongs to and which can be used to reparameterize it.
Source§

type To<T: Parameter> = <<P as Parameterized<P>>::Family as ParameterizedFamily<T>>::To where <P as Parameterized<P>>::Family: ParameterizedFamily<T>

Reparameterized form of this Parameterized type with all of its nested P parameter types replaced by T. This preserves the same Family and ParameterStructure, and is such that reparameterizing back to P recovers Self.
Source§

type ParameterStructure = <P as Parameterized<P>>::To<Placeholder>

Type that represents a shape-only representation of this Parameterized type with all nested P parameter types replaced by Placeholder. This must always be set to Self::To<Placeholder>. The only reason this is not done by default is that defaulted associated types are not supported in stable Rust, and this forces us to require that all implementations provide an implementation for this associated type as well.
Source§

type ParameterIterator<'t, T: 't + Parameter> = Once<&'t T> where P: 't

Iterator returned by Self::parameters for a borrow of the underlying Parameters with lifetime 't. This is an associated type instead of an impl Iterator in the corresponding function signature, so that implementations can expose and reuse a concrete iterator type. In particular, #[derive(Parameterized)] for enums synthesizes concrete enum iterators here, avoiding an additional heap allocation and dynamic dispatch.
Source§

type ParameterIteratorMut<'t, T: 't + Parameter> = Once<&'t mut T> where P: 't

Iterator returned by Self::parameters_mut for a mutable borrow of the underlying Parameters with lifetime 't. Similar to Self::ParameterIterator, this is an associated type instead of an impl Iterator in the corresponding function signature, so that implementations can expose and reuse a concrete iterator type, potentially avoiding additional heap allocations and dynamic dispatch.
Source§

type ParameterIntoIterator<T: Parameter> = Once<T>

Iterator returned by Self::into_parameters, consuming self and returning the underlying Parameters. Similar to Self::ParameterIterator, this is an associated type instead of an impl Iterator in the corresponding function signature, so that implementations can expose and reuse a concrete iterator type, potentially avoiding additional heap allocations and dynamic dispatch.
Source§

type NamedParameterIterator<'t, T: 't + Parameter> = Once<(ParameterPath, &'t T)> where P: 't

Iterator returned by Self::named_parameters, borrowing the underlying Parameters and pairing them with their corresponding ParameterPaths. Similar to Self::ParameterIterator, this is an associated type instead of an impl Iterator in the corresponding function signature, so that implementations can expose and reuse a concrete iterator type, potentially avoiding additional heap allocations and dynamic dispatch.
Source§

type NamedParameterIteratorMut<'t, T: 't + Parameter> = Once<(ParameterPath, &'t mut T)> where P: 't

Iterator returned by Self::named_parameters_mut, mutably borrowing the underlying Parameters and pairing them with their corresponding ParameterPaths. Similar to Self::ParameterIterator, this is an associated type instead of an impl Iterator in the corresponding function signature, so that implementations can expose and reuse a concrete iterator type, potentially avoiding additional heap allocations and dynamic dispatch.
Source§

type NamedParameterIntoIterator<T: Parameter> = Once<(ParameterPath, T)>

Iterator returned by Self::into_named_parameters, consuming self and returning the underlying Parameters together with their corresponding ParameterPaths. Similar to Self::ParameterIterator, this is an associated type instead of an impl Iterator in the corresponding function signature, so that implementations can expose and reuse a concrete iterator type, potentially avoiding additional heap allocations and dynamic dispatch.
Source§

fn parameter_count(&self) -> usize

Returns the number of parameters in this Parameterized value.
Source§

fn parameter_structure(&self) -> <P as Parameterized<P>>::ParameterStructure

Returns the structure of this value by replacing all of its nested parameters with Placeholders.
Source§

fn parameters(&self) -> <P as Parameterized<P>>::ParameterIterator<'_, P>

Returns an iterator over references to all parameters in this Parameterized value. The returned iterator traverses the parameters in the same order as Self::parameters_mut, Self::into_parameters, Self::named_parameters, Self::named_parameters_mut, and Self::into_named_parameters.
Source§

fn parameters_mut( &mut self, ) -> <P as Parameterized<P>>::ParameterIteratorMut<'_, P>

Returns an iterator over mutable references to all parameters in this Parameterized value. The returned iterator traverses the parameters in the same order as Self::parameters, Self::into_parameters, Self::named_parameters, Self::named_parameters_mut, and Self::into_named_parameters.
Source§

fn into_parameters(self) -> <P as Parameterized<P>>::ParameterIntoIterator<P>

Consumes this Parameterized value and returns an iterator over all parameters contained in it. The returned iterator traverses the parameters in the same order as Self::parameters, Self::parameters_mut, Self::named_parameters, Self::named_parameters_mut, and Self::into_named_parameters.
Source§

fn named_parameters( &self, ) -> <P as Parameterized<P>>::NamedParameterIterator<'_, P>

Returns an iterator over references to all parameters in this Parameterized value, paired with their corresponding ParameterPaths. The returned iterator traverses the parameters in the same order as Self::parameters, Self::parameters_mut, Self::into_parameters, Self::named_parameters_mut, and Self::into_named_parameters.
Source§

fn named_parameters_mut( &mut self, ) -> <P as Parameterized<P>>::NamedParameterIteratorMut<'_, P>

Returns an iterator over mutable references to all parameters in this Parameterized value, paired with their corresponding ParameterPaths. The returned iterator traverses the parameters in the same order as Self::parameters, Self::parameters_mut, Self::into_parameters, Self::named_parameters, and Self::into_named_parameters.
Source§

fn into_named_parameters( self, ) -> <P as Parameterized<P>>::NamedParameterIntoIterator<P>

Consumes this Parameterized value and returns an iterator over all parameters contained in it, paired with their corresponding ParameterPaths. The returned iterator traverses the parameters in the same order as Self::parameters, Self::parameters_mut, Self::into_parameters, Self::named_parameters, and Self::named_parameters_mut.
Source§

fn from_parameters_with_remainder<I>( _structure: <P as Parameterized<P>>::ParameterStructure, parameters: &mut I, ) -> Result<P, Error>
where I: Iterator<Item = P>,

Reconstructs a value of this Parameterized type having the provided structure and consuming values from the provided parameters to populate its parameters. This function may not consume all the provided parameters, but if there are not enough parameters in the provided iterator, it will return a Error::MissingParameters error.
Source§

fn parameter_paths<'p>(&'p self) -> impl 'p + Iterator<Item = ParameterPath>
where P: 'p,

Returns an iterator over the ParameterPaths to all nested parameters in this Parameterized value. The returned iterator traverses the paths in the same order as Self::parameters, Self::parameters_mut, Self::into_parameters, Self::named_parameters, Self::named_parameters_mut, and Self::into_named_parameters.
Source§

fn from_parameters<I: IntoIterator<Item = P>>( structure: Self::ParameterStructure, parameters: I, ) -> Result<Self, Error>

Reconstructs a value of this Parameterized type having the provided structure and consuming values from the provided parameters to populate its parameters. This function expects to fully consume the provided iterator. If it does not contain enough values, then it will return a Error::MissingParameters error, while if it contains too many values, it will return an Error::UnusedParameters. If you do not want to fully consume the provided iterator, then you must use Self::from_parameters_with_remainder instead.
Source§

fn from_named_parameters<I: IntoIterator<Item = (ParameterPath, P)>>( structure: Self::ParameterStructure, parameters: I, ) -> Result<Self, Error>

Reconstructs a value of this Parameterized type having the provided structure and consuming named values from the provided parameters to populate its parameters. Unlike Self::from_broadcasted_named_parameters, this function is strict in that keys in parameters must match exactly leaf ParameterPaths in structure, and path prefix matching is not being used. If there are missing parameters preventing reconstruction from being feasible, then this function will return a Error::MissingParameters error. Furthermore, if extra paths remain after reconstruction, then it will return an Error::UnusedParameters error. For fully worked examples, refer to the examples provided in the top-level documentation of the Parameterized trait.
Source§

fn from_broadcasted_named_parameters<I: IntoIterator<Item = (ParameterPath, P)>>( structure: Self::ParameterStructure, parameters: I, ) -> Result<Self, Error>
where P: Clone,

Reconstructs a value of this Parameterized type having the provided structure and consuming named values from the provided parameters to populate its parameters, where keys in parameters are interpreted as path prefixes. Unlike Self::from_named_parameters, this function does not require exact leaf paths, and each leaf path in structure receives the value from the most specific matching path prefix (i.e., the longest shared path prefix). If any leaf path is not covered by a provided prefix, then this function will return a Error::MissingParameters error. Furthermore, if there are any remaining ParameterPaths with no match in structure, then it will return an Error::UnusedParameters error. Note that since one prefix value may need to populate multiple leaves, this function requires P: Clone. For fully worked examples, refer to the examples provided in the top-level documentation of the Parameterized trait.
Source§

fn map_parameters<T: Parameter, F: FnMut(P) -> T>( self, map_fn: F, ) -> Result<Self::To<T>, Error>
where Self::Family: ParameterizedFamily<T>,

Maps each nested Parameter of type P in this value using the provided map_fn to a Parameter of type T, while preserving the Parameterized structure of this type. Nested parameters are visited in the same order as Self::parameters, Self::parameters_mut, Self::into_parameters, Self::named_parameters, Self::named_parameters_mut, and Self::into_named_parameters.
Source§

fn map_named_parameters<T: Parameter, F: FnMut(&ParameterPath, P) -> T>( self, map_fn: F, ) -> Result<Self::To<T>, Error>
where Self::Family: ParameterizedFamily<T>,

Maps each nested Parameter of type P in this value using the provided map_fn, which receives the ParameterPath for each Parameter along with its value, and returns a new Parameter value of type T, while preserving the Parameterized structure of this type. Nested parameters are visited in the same order as Self::parameters, Self::parameters_mut, Self::into_parameters, Self::named_parameters, Self::named_parameters_mut, and Self::into_named_parameters.
Source§

fn filter_parameters<F: FnMut(&ParameterPath, &P) -> bool>( self, predicate: F, ) -> Result<Self::To<Option<P>>, Error>

Filters all nested Parameters of type P in this value according to the provided predicate, producing a structure-preserving Parameterized value with Option<P> leaves. Specifically, this value is a Parameterized<P> and this function returns a Parameterized<Option<P>> where each parameter of this value for which predicate returns true is kept as Some, while all other parameters are replaced by None. Read more
Source§

fn partition_parameters<F: FnMut(&ParameterPath, &P) -> bool>( self, predicate: F, ) -> Result<(Self::To<Option<P>>, Self::To<Option<P>>), Error>

Partitions all nested Parameters of type P in this value into two structure-preserving Parameterized values, according to the provided predicate. Specifically, this value is a Parameterized<P> and this function returns a pair of Parameterized<Option<P>> values. The first one contains Some for each parameter for which the provided predicate returns true, and None elsewhere, and the opposite holds for the second returned value. This function is equivalent to using Self::filter_parameters twice on the same value, but it avoids traversing the structure twice. Read more
Source§

fn combine_parameters<I: IntoIterator<Item = Self::To<Option<P>>>>( structure: Self::ParameterStructure, values: I, ) -> Result<Self, Error>

Combines multiple structure-aligned Parameterized<Option<P>> values into a single Parameterized<P> value, using left-to-right precedence at each parameter location. That is, for each leaf ParameterPath in structure, this function selects the first Some value from values and uses it for the corresponding location in the resulting Parameterized value that the function returns. If multiple non-None values are present for the same leaf, then they must all be equal, and otherwise this function returns an Error::AmbiguousParameterCombination error. If no Some value is found for some leaf ParameterPath, then this function will return a Error::MissingParameters error. Furthermore, if any of the provided values contains additional Parameters, beyond those that correspond to ones in structure, then this function will return an Error::UnusedParameters error. Read more
Source§

fn replace_parameters( self, replacement: Self::To<Option<P>>, ) -> Result<Self, Error>

Replaces nested Parameters of type P in this value using a structure-aligned Parameterized<Option<P>> replacement value. For each parameter, Some in replacement overrides the current value from self, while None keeps the current value unchanged. If replacement is missing parameters for the expected structure, this function will return a Error::MissingParameters error. Furthermore, if replacement contains extra parameters, this function will return an Error::UnusedParameters error. Read more
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> 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, 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> SameAs<T> for T