Module frunk_core::generic [−][src]
This module holds the machinery behind Generic
.
It contains the Generic
trait and some helper methods for using the
Generic
trait without having to use universal function call syntax.
Examples
#[macro_use] extern crate frunk; #[macro_use] extern crate frunk_core; #[derive(Generic)] struct ApiPerson<'a> { FirstName: &'a str, LastName: &'a str, Age: usize, } #[derive(Generic)] struct DomainPerson<'a> { first_name: &'a str, last_name: &'a str, age: usize, } let a_person = ApiPerson { FirstName: "Joe", LastName: "Blow", Age: 30, }; let d_person: DomainPerson = frunk::convert_from(a_person); // doneRun
Traits
Generic | A trait that converts from a type to a generic representation. |
Functions
convert_from | Converts one type |
from_generic | Given a generic representation |
into_generic | Given a value of type |
map_inter | Maps a value of a given type |
map_repr | Maps a value of a given type |