From e41b367e0ff5c31395b0fe9786f6ac1aeb7c833d Mon Sep 17 00:00:00 2001 From: rasul Date: Sun, 5 Apr 2020 15:15:44 -0500 Subject: [PATCH] document Zone::from_ref() --- src/world/zone.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/world/zone.rs b/src/world/zone.rs index 693692e..8b55e3d 100644 --- a/src/world/zone.rs +++ b/src/world/zone.rs @@ -19,6 +19,29 @@ pub struct Zone { } impl Zone { + /// Create a new `Zone` from a `&Zone`. + /// + /// # Arguments + /// + /// * `zone: &Zone` : Reference to a `Zone` + /// + /// # Examples + /// + /// ``` + /// use std::collections::HashSet; + /// use rude::id::Id; + /// use rude::world::Zone; + /// + /// let zone = Zone { + /// id: Id::new(), + /// parent: Id::new(), + /// name: "Zone".into(), + /// users_visible: false, + /// areas: HashSet::new(), + /// }; + /// + /// assert_eq!(zone, Zone::from_ref(&zone)); + /// ``` pub fn from_ref(zone: &Self) -> Self { Self { id: zone.id,