Derive Copy and Clone traits for Tag for future APIs.
This commit is contained in:
parent
61d78aa197
commit
c9ccdc343a
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue