// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. //! Named Tuples use std::fmt::Debug; use moretypes::named_tuple; #[named_tuple] struct Triple { x: T, y: T, z: T, } #[named_tuple(tuple_methods = false)] #[derive(Debug)] #[allow(dead_code)] struct NoTupleMethods<'a> { foo: &'a str, bar: &'a str, } #[named_tuple(constructor = false)] struct NoConstructor { width: u32, height: u32, } pub fn main() { let it = Triple::new(1.0, 3.0, 5.0); println!("{:?}", it.as_tuple()); let it = NoTupleMethods::new("foo", "bar"); println!("{it:?}"); let it = NoConstructor::from((1920, 1080)); println!("{:?}", it.as_tuple()); }