rename TupleBuilder to NextTuple and prep for release

This commit is contained in:
Greg Johnston
2024-04-27 11:22:04 -04:00
parent 11d134c4ba
commit e68730d15f
9 changed files with 43 additions and 38 deletions

View File

@@ -1,6 +1,12 @@
[package]
name = "next_tuple"
version = "0.1.0"
version = "0.1.0-preview"
edition = "2021"
authors = ["Greg Johnston"]
license = "MIT"
readme = "../README.md"
repository = "https://github.com/leptos-rs/leptos"
description = "A trait to build and extend tuples."
rust-version.workspace = true
[dependencies]

1
next_tuple/README.md Normal file
View File

@@ -0,0 +1 @@
Allows extending a tuple, or creating a new tuple, by adding the next value.

View File

@@ -1,21 +1,19 @@
#![no_std]
#![allow(non_snake_case)]
#![forbid(unsafe_code)]
pub trait TupleBuilder {
/// Allows extending a tuple, or creating a new tuple, by adding the next value.
pub trait NextTuple {
/// The type that will be returned by adding another value of type `Next` to the end of the current type.
type Output<Next>;
/// Adds the next value and returns the result.
fn next_tuple<Next>(self, next: Next) -> Self::Output<Next>;
}
pub trait ConcatTuples<Next> {
type Output;
fn concat(self, next: Next) -> Self::Output;
}
macro_rules! impl_tuple_builder {
($($ty:ident),*) => {
impl<$($ty),*> TupleBuilder for ($($ty,)*) {
impl<$($ty),*> NextTuple for ($($ty,)*) {
type Output<Next> = ($($ty,)* Next);
fn next_tuple<Next>(self, next: Next) -> Self::Output<Next> {
@@ -26,7 +24,7 @@ macro_rules! impl_tuple_builder {
};
}
impl TupleBuilder for () {
impl NextTuple for () {
type Output<Next> = (Next,);
fn next_tuple<Next>(self, next: Next) -> Self::Output<Next> {