Skip to content

Commit 62a65db

Browse files
committed
Add id_size and is_sealed methods
1 parent 842bb82 commit 62a65db

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

negentropy/src/lib.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,19 +249,29 @@ impl Negentropy {
249249
})
250250
}
251251

252+
/// Get current ID size
253+
pub fn id_size(&self) -> usize {
254+
self.id_size
255+
}
256+
252257
/// Check if current instance it's an initiator
253258
pub fn is_initiator(&self) -> bool {
254259
self.is_initiator
255260
}
256261

262+
/// Check if sealed
263+
pub fn is_sealed(&self) -> bool {
264+
self.sealed
265+
}
266+
257267
/// Check if need to continue
258268
pub fn continuation_needed(&self) -> bool {
259269
self.continuation_needed
260270
}
261271

262272
/// Add item
263273
pub fn add_item(&mut self, created_at: u64, id: Bytes) -> Result<(), Error> {
264-
if self.sealed {
274+
if self.is_sealed() {
265275
return Err(Error::AlreadySealed);
266276
}
267277

@@ -297,7 +307,7 @@ impl Negentropy {
297307

298308
/// Seal
299309
pub fn seal(&mut self) -> Result<(), Error> {
300-
if self.sealed {
310+
if self.is_sealed() {
301311
return Err(Error::AlreadySealed);
302312
}
303313
self.sealed = true;

0 commit comments

Comments
 (0)