codegen_rs/
associated_type.rs

1use crate::bound::Bound;
2use crate::r#type::Type;
3
4/// Defines an associated type.
5#[derive(Debug, Clone)]
6pub struct AssociatedType(pub Bound);
7
8impl AssociatedType {
9    /// Add a bound to the associated type.
10    pub fn bound<T>(&mut self, ty: T) -> &mut Self
11    where
12        T: Into<Type>,
13    {
14        self.0.bound.push(ty.into());
15        self
16    }
17}