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
impl Clone for Placeholder
Source§fn clone(&self) -> Placeholder
fn clone(&self) -> Placeholder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Placeholder
impl Debug for Placeholder
Source§impl Display for Placeholder
impl Display for Placeholder
Source§impl Hash for Placeholder
impl Hash for Placeholder
Source§impl Ord for Placeholder
impl Ord for Placeholder
Source§fn cmp(&self, other: &Placeholder) -> Ordering
fn cmp(&self, other: &Placeholder) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for Placeholder
impl PartialEq for Placeholder
Source§impl PartialOrd for Placeholder
impl PartialOrd for Placeholder
impl Copy for Placeholder
impl Eq for Placeholder
impl Parameter for Placeholder
impl StructuralPartialEq for Placeholder
Auto Trait Implementations§
impl Freeze for Placeholder
impl RefUnwindSafe for Placeholder
impl Send for Placeholder
impl Sync for Placeholder
impl Unpin for Placeholder
impl UnsafeUnpin for Placeholder
impl UnwindSafe for Placeholder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<P> Parameterized<P> for Pwhere
P: Parameter,
impl<P> Parameterized<P> for Pwhere
P: Parameter,
Source§type Family = ParameterParameterizedFamily
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>
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 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
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
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>
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
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
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)>
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
fn parameter_count(&self) -> usize
Returns the number of parameters in this
Parameterized value.Source§fn parameter_structure(&self) -> <P as Parameterized<P>>::ParameterStructure
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>
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>
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>
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>
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>
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>
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>,
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,
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>
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>
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,
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>,
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>,
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>
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 moreSource§fn partition_parameters<F: FnMut(&ParameterPath, &P) -> bool>(
self,
predicate: F,
) -> Result<(Self::To<Option<P>>, Self::To<Option<P>>), Error>
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 moreSource§fn combine_parameters<I: IntoIterator<Item = Self::To<Option<P>>>>(
structure: Self::ParameterStructure,
values: I,
) -> Result<Self, Error>
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 moreSource§fn replace_parameters(
self,
replacement: Self::To<Option<P>>,
) -> Result<Self, Error>
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