Derive Copy and Clone traits for Tag for future APIs.

This commit is contained in:
KAMADA Ken'ichi 2017-03-15 23:42:14 +09:00
parent 61d78aa197
commit c9ccdc343a
1 changed files with 3 additions and 3 deletions

View File

@ -43,19 +43,19 @@ use std::fmt;
// PartialEq and Eq need to be _automatically derived_ for Tag to // PartialEq and Eq need to be _automatically derived_ for Tag to
// emulate structural equivalency. // emulate structural equivalency.
// <https://github.com/rust-lang/rfcs/pull/1445> // <https://github.com/rust-lang/rfcs/pull/1445>
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct Tag(pub Context, pub u16); pub struct Tag(pub Context, pub u16);
impl Tag { impl Tag {
/// Returns the context of the tag. /// Returns the context of the tag.
#[inline] #[inline]
pub fn context(&self) -> Context { pub fn context(self) -> Context {
self.0 self.0
} }
/// Returns the value of the tag. /// Returns the value of the tag.
#[inline] #[inline]
pub fn value(&self) -> u16 { pub fn value(self) -> u16 {
self.1 self.1
} }