However, implementations may not be able to guarantee the presence of a left or right child, or the infallibility of the get operations. Right now, implementations of ParentNode assume that the operation is guaranteed to succeed, and use unwraps. In the case of database-backed storage nodes, the operations may fail for various reasons, including data corruption or connection failures. Therefore, the trait functions should return Result<Option<Self>> instead.
Because ParentNode is used in the PathIter, PathIter will have to be refactored to accommodate the modified interface. This means using Item = (Result<Option<T>>, Result<Option<T>>).
Currently,
ParentNode
is defined by:However, implementations may not be able to guarantee the presence of a left or right child, or the infallibility of the get operations. Right now, implementations of
ParentNode
assume that the operation is guaranteed to succeed, and use unwraps. In the case of database-backed storage nodes, the operations may fail for various reasons, including data corruption or connection failures. Therefore, the trait functions should returnResult<Option<Self>>
instead.Because
ParentNode
is used in thePathIter
,PathIter
will have to be refactored to accommodate the modified interface. This means usingItem = (Result<Option<T>>, Result<Option<T>>)
.