diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-03-27 11:07:29 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-03-27 11:07:29 +0200 |
commit | 4618ccc2a2dbc73503c32464e2a05043e4f04227 (patch) | |
tree | 8bfecd8bbffa235d98ca852b8970027a28175182 /src/chunkid.rs | |
parent | 5af0888b60ba124d537efda829a5ba3f7130d07a (diff) | |
download | obnam2-4618ccc2a2dbc73503c32464e2a05043e4f04227.tar.gz |
refactor: rename ChunkId::from_str to ChunkId::recreate
Less confusion with FromStr::from_str this way.
Diffstat (limited to 'src/chunkid.rs')
-rw-r--r-- | src/chunkid.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/chunkid.rs b/src/chunkid.rs index 3933d4b..2f67d79 100644 --- a/src/chunkid.rs +++ b/src/chunkid.rs @@ -37,7 +37,8 @@ impl ChunkId { } } - pub fn from_str(s: &str) -> Self { + /// Re-construct an identifier from a previous values. + pub fn recreate(s: &str) -> Self { ChunkId { id: s.to_string() } } @@ -85,7 +86,7 @@ impl FromStr for ChunkId { type Err = (); fn from_str(s: &str) -> Result<Self, Self::Err> { - Ok(ChunkId::from_str(s)) + Ok(ChunkId::recreate(s)) } } @@ -117,6 +118,6 @@ mod test { fn survives_round_trip() { let id = ChunkId::new(); let id_str = id.to_string(); - assert_eq!(id, ChunkId::from_str(&id_str)) + assert_eq!(id, ChunkId::recreate(&id_str)) } } |