pub trait KnownTuple<'a> {
type RefTuple: 'a + KnownTuple<'a>;
type FnPointer: KnownFnPointer<ArgsTuple = Self>;
// Required method
fn as_tuple_of_refs(&'a self) -> Self::RefTuple;
}
Required Associated Types§
Sourcetype RefTuple: 'a + KnownTuple<'a>
type RefTuple: 'a + KnownTuple<'a>
The corresponding tuple type which references each item.
use tuple_fn::KnownTuple;
let _: <() as KnownTuple>::RefTuple = ();
let _: <(i32,) as KnownTuple>::RefTuple = (&1,);
let _: <(i32, bool) as KnownTuple>::RefTuple = (&1, &true);
let _: <(i32, bool, &u8) as KnownTuple>::RefTuple = (&1, &true, &&0u8);
Sourcetype FnPointer: KnownFnPointer<ArgsTuple = Self>
type FnPointer: KnownFnPointer<ArgsTuple = Self>
The fn
pointer type which accepts this tuple as arguments and returns ()
.
For example, the following types in each pair are equivalent.
<() as KnownTuple>::FnPointer, fn()
<(i32,) as KnownTuple>::FnPointer, fn(i32)
<(i32, bool) as KnownTuple>::FnPointer, fn(i32, bool)
Required Methods§
Sourcefn as_tuple_of_refs(&'a self) -> Self::RefTuple
fn as_tuple_of_refs(&'a self) -> Self::RefTuple
Convert ref of tuple to tuple of refs.
let _: (&i8, &String) = (1, "hello".to_string()).as_tuple_of_refs();