Module giftbox::giftbox [−][src]
Expand description
This module defines the GiftWrap enum which is the base generic type used in this crate. It
represents a real-life gift box which can hold any gift that can fit within the box. The enum
has two variants:
- Gifts(T) - Which represents a gift box with whatever
Giftscontained asT. - Empty - Which represents an empty gift box.
Examples
use giftbox::giftbox::GiftBox; use giftbox::gifttag::GiftTag; use giftbox::giftwrap::GiftWrap; use giftbox::patterns::Patterns; let filled_box = GiftBox::fill(Some(["Toys", "Candy", "Money"])); let tag = GiftTag::write( "Bob".to_string(), "Sally".to_string(), "Happy Cake Day!".to_string() ); let wrapped_box = filled_box.wrap( Patterns::Polkadots, true, Some(tag) ); assert_eq!( wrapped_box, { GiftWrap { contents:{ GiftBox::Gifts(["Toys", "Candy", "Money"]) }, pattern: Patterns::Polkadots, has_bow: true, tag: Some( GiftTag { recipient: "Bob".to_string(), sender: "Sally".to_string(), message: "Happy Cake Day!".to_string() } ) } } )
Enums
A GiftBox type for Rust that could contain any type of gift that can be represented as a Rust
type.