mirror of
https://github.com/leptos-rs/leptos.git
synced 2025-12-27 09:54:41 -05:00
rename TupleBuilder to NextTuple and prep for release
This commit is contained in:
@@ -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
1
next_tuple/README.md
Normal file
@@ -0,0 +1 @@
|
||||
Allows extending a tuple, or creating a new tuple, by adding the next value.
|
||||
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user