-
Type:
Task
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
Right now, how to convert between these various types is kind of a mess:
RawBsonRef to RawBson => RawBsonRef::to_raw_bson
RawBsonRef to Bson => impl TryFrom
RawBson to RawBsonRef => RawBson::as_raw_bson_ref
RawBson to Bson => impl TryFrom
Bson to RawBson => impl TryFrom
RawDocument to RawDocumentBuf => RawDocument::to_raw_document_buf and impl ToOwned
RawDocument to Document => impl TryFrom
RawDocumentBuf to RawDocument => impl Deref
RawDocumentBuf to Document => impl TryFrom and RawDocumentBuf::to_document
Document to RawDocumentBuf => impl TryFrom and RawDocumentBuf:from_document
RawArray to RawArrayBuf => RawArray::to_raw_array_buf and impl ToOwned
RawArray to Array => impl TryFrom
RawArrayBuf to RawArray => impl Deref
RawArrayBuf to Array => none (can go via RawArray)
Array to RawArrayBuf => none
I propose we standardize around the standard conversion traits rather than having a mix of traits and explicit functions. The exception to this is RawBson::as_raw_bson_ref, which IMO should exist by analogy to as_ref.