Skip to content

Commit

Permalink
feat(vt): add conversion from NullableObjectId to Option<ObjectId>
Browse files Browse the repository at this point in the history
  • Loading branch information
GwnDaan committed Dec 14, 2023
1 parent baf3720 commit bedbae3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/object_pool/object_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl ObjectId {
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct NullableObjectId(Option<ObjectId>);
pub struct NullableObjectId(pub Option<ObjectId>);

impl NullableObjectId {
pub const NULL: NullableObjectId = NullableObjectId(None);
Expand Down Expand Up @@ -75,6 +75,12 @@ impl TryFrom<u16> for ObjectId {
}
}

impl From<NullableObjectId> for Option<ObjectId> {
fn from(id: NullableObjectId) -> Self {
return id.0;

Check warning on line 80 in src/object_pool/object_id.rs

View check run for this annotation

Codecov / codecov/patch

src/object_pool/object_id.rs#L79-L80

Added lines #L79 - L80 were not covered by tests
}
}

impl From<ObjectId> for u16 {
fn from(val: ObjectId) -> Self {
val.id
Expand Down

0 comments on commit bedbae3

Please sign in to comment.