Skip to main content

Parameter

Trait Parameter 

Source
pub trait Parameter { }
Expand description

Marker trait for leaf parameter values in a Parameterized type. This trait is intentionally empty. A type implementing Parameter is treated as an indivisible leaf by Parameterized traversals. The reason we need this trait in the first place is so that we can distinguish between leaf and container behavior in blanket implementations. For example, Vec<V> implements Parameterized<P> when V: Parameterized<P>. Therefore, Vec<P> is treated as a collection of leaf parameters because P: Parameter implies P: Parameterized<P>, and not as a single leaf. Without this marker, expressing both leaf and container semantics would require overlapping blanket implementations or a stable specialization feature.

Note that ryft provides a derive macro for this trait that you can use for custom types which need to implement Parameter by tagging them with #[derive(Parameter)].

Implementations on Foreign Types§

Source§

impl Parameter for bool

Source§

impl Parameter for f32

Source§

impl Parameter for f64

Source§

impl Parameter for i8

Source§

impl Parameter for i16

Source§

impl Parameter for i32

Source§

impl Parameter for i64

Source§

impl Parameter for i128

Source§

impl Parameter for u8

Source§

impl Parameter for u16

Source§

impl Parameter for u32

Source§

impl Parameter for u64

Source§

impl Parameter for u128

Source§

impl Parameter for usize

Source§

impl Parameter for bf16

Source§

impl Parameter for f16

Source§

impl<P: Parameter> Parameter for Option<P>

Implementors§