impl From<&Zone> instead of the from_ref() method

master
rasul 5 years ago
parent df632447fd
commit a493f868d4

@ -28,31 +28,8 @@ pub struct Zone {
pub areas: HashSet<Id>, pub areas: HashSet<Id>,
} }
impl Zone { impl From<&Zone> for Zone {
/// Create a new `Zone` from a `&Zone`. fn from(zone: &Zone) -> Self {
///
/// # 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 { Self {
id: zone.id, id: zone.id,
parent: zone.parent, parent: zone.parent,

Loading…
Cancel
Save