1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/// A trait that provides access to the list of named fields of a struct
/// represented as string literals.
///
/// This trait is not intended to be implemented manually. Instead,
/// use the `#[derive(Fields)]` macro from `extruct` library.
#[cfg(any(feature = "fields", doc))]
pub trait Fields {
    /// Get the list of names of fields of the struct.
    fn fields() -> &'static [&'static str];
}

/// A marker trait indicating that a struct which implements it
/// has been annotated with `[extruct_from(T)]` for the given type T.
/// It is an extension over the [`std::convert::From`](https://doc.rust-lang.org/std/convert/trait.From.html)
/// trait and verifies that all names of the fields are preserved during
/// conversion.
///
/// This trait is not intended to be implemented manually. Its whole
/// purpose is to indicate the use of the `extruct_from` macro on a
/// struct that implements it.
#[cfg(any(feature = "extruct_from", doc))]
pub trait ExtructedFrom<T>: std::convert::From<T> {}