Skip to content

Commit

Permalink
whoops, remove references to make_invalid function, add make_null fun…
Browse files Browse the repository at this point in the history
…ction
  • Loading branch information
tonyb983 committed May 4, 2022
1 parent c575d5b commit 4ea8d03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -23,7 +23,8 @@ use tinyid::TinyId;
let mut id = TinyId::random();
assert!(id.is_valid());
assert!(!id.is_null());
id.make_invalid();

id.make_null();
assert!(!id.is_valid());
assert!(id.is_null());
assert_eq!(id, TinyId::null());
Expand Down
7 changes: 6 additions & 1 deletion src/lib.rs
Expand Up @@ -18,7 +18,7 @@
//! let mut id = TinyId::random();
//! assert!(id.is_valid());
//! assert!(!id.is_null());
//! id.make_invalid();
//! id.make_null();
//! assert!(!id.is_valid());
//! assert!(id.is_null());
//! assert_eq!(id, TinyId::null());
Expand Down Expand Up @@ -166,6 +166,11 @@ impl TinyId {
self.data == Self::NULL_DATA
}

/// Makes this [`TinyId`] null.
pub fn make_null(&mut self) {
self.data = Self::NULL_DATA;
}

fn from_str(s: &str) -> std::result::Result<Self, TinyIdError> {
use std::char::TryFromCharError;
if s.len() != 8 {
Expand Down

0 comments on commit 4ea8d03

Please sign in to comment.