Skip to content

Implement From<T> for Bson for more integer types #627

@tyilo

Description

@tyilo

To make doc! { "foo": v } more ergonomic, it would be nice if the following types implemented infallible conversion to Bson:

Smaller integer types

i8, i16 -> Bson::Int32
u8, u16 -> Bson::Int32

NonZero<T> types where Bson: From<T>

This direction is lossless.

Platform-specific types

isize, usize -> Bson::Int64

I don't think that this should be added for compatibility reasons, but I wanted to add it as an option.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions