Skip to content

Commit

Permalink
TypeParameter::new_portable for non breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
ascjones committed Oct 7, 2022
1 parent 1044c8d commit c9149c2
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,21 +213,30 @@ impl IntoPortable for TypeParameter {
}
}

impl TypeParameter<MetaForm> {
/// Create a new [`TypeParameter`].
pub fn new(
name: <MetaForm as Form>::String,
ty: Option<<MetaForm as Form>::Type>,
) -> Self {
Self { name, ty }
}
}

impl TypeParameter<PortableForm> {
/// Create a new [`TypeParameter`] in [`PortableForm`].
pub fn new_portable(
name: <PortableForm as Form>::String,
ty: Option<<PortableForm as Form>::Type>,
) -> Self {
Self { name, ty }
}
}

impl<T> TypeParameter<T>
where
T: Form,
{
/// Create a new [`TypeParameter`].
pub fn new<S>(name: S, ty: Option<T::Type>) -> Self
where
S: Into<T::String>,
{
Self {
name: name.into(),
ty,
}
}

/// Get the type of the parameter.
///
/// `None` if the parameter is skipped.
Expand Down

0 comments on commit c9149c2

Please sign in to comment.