diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-03-21 16:43:03 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-03-21 16:43:03 +0100 |
commit | fe5a468195477ffa2b70ca81349d08f591a7886a (patch) | |
tree | ae6c5fc7c6d56d51166929814849e3b97e88ae70 /openpgp | |
parent | 10b03af183988ae73eee9e99c9ea70e87513c5cd (diff) |
openpgp: Remove UserID::new() and the mutators.
- I don't see a reason to mutate userids.
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/src/packet/userid.rs | 18 | ||||
-rw-r--r-- | openpgp/src/serialize/mod.rs | 3 |
2 files changed, 1 insertions, 20 deletions
diff --git a/openpgp/src/packet/userid.rs b/openpgp/src/packet/userid.rs index 15157621..eb5d9225 100644 --- a/openpgp/src/packet/userid.rs +++ b/openpgp/src/packet/userid.rs @@ -61,28 +61,10 @@ impl fmt::Debug for UserID { } impl UserID { - /// Returns a new `UserID` packet. - pub fn new() -> UserID { - UserID { - common: Default::default(), - value: Vec::new(), - } - } - /// Gets the user ID packet's value. pub fn userid(&self) -> &[u8] { self.value.as_slice() } - - /// Sets the user ID packet's value from a byte sequence. - pub fn set_userid_from_bytes(&mut self, userid: &[u8]) -> Vec<u8> { - ::std::mem::replace(&mut self.value, userid.to_vec()) - } - - /// Sets the user ID packet's value from a UTF-8 encoded string. - pub fn set_userid(&mut self, userid: &str) -> Vec<u8> { - self.set_userid_from_bytes(userid.as_bytes()) - } } impl From<UserID> for Packet { diff --git a/openpgp/src/serialize/mod.rs b/openpgp/src/serialize/mod.rs index 9813df47..0dc6280c 100644 --- a/openpgp/src/serialize/mod.rs +++ b/openpgp/src/serialize/mod.rs @@ -2208,8 +2208,7 @@ mod test { // 1: UserID(UserID { value: "Foo" }) let mut top_level = Vec::new(); - let mut uid = UserID::new(); - uid.set_userid("Foo"); + let uid = UserID::from("Foo"); top_level.push(uid.into()); messages.push(top_level); |