1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
//! Derive trivial transformations between fields that are mostly unpacking and converting
//! similarly-nemd fields from a source into a target.
//! Example usage:
//!
//! ```
//! use namewise;
//! use std::collections::HashSet;
//!
//! struct Source {
//! a: &'static str,
//! text: String,
//! numeric: i16,
//! truth: bool,
//! truths: Vec<bool>,
//! }
//!
//! #[derive(namewise::From)]
//! #[namewise_from(from_type = "Source")]
//! struct Destination {
//! a: String,
//! text: String,
//! #[namewise_from(from_name = "numeric")]
//! number: i64,
//! #[namewise_from(collect)]
//! truths: HashSet<bool>,
//! }
//! ```
//!
//! This should be equivalent to:
//!
//! ```
//! use std::collections::HashSet;
//!
//! struct Source {
//! a: &'static str,
//! text: String,
//! numeric: i16,
//! truth: bool,
//! truths: Vec<bool>,
//! }
//!
//! struct Destination {
//! a: String,
//! text: String,
//! number: i64,
//! truths: HashSet<bool>,
//! }
//!
//! impl From<Source> for Destination {
//! fn from(value: Source) -> Destination {
//! Destination {
//! a: value.a.into(),
//! text: value.text.into(),
//! number: value.numeric.into(),
//! truths: value.truths.into_iter().collect(),
//! }
//! }
//! }
//! ```
#![deny(warnings)]
#![deny(clippy::all)]
pub use namewise_common::NamewiseError;
pub use namewise_derive::{From, Into, TryFrom};